summaryrefslogtreecommitdiff
path: root/pkg/bindings
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-03-30 20:51:00 +0200
committerGitHub <noreply@github.com>2021-03-30 20:51:00 +0200
commit989c8e97851c1a443270e803e19dd069fc199302 (patch)
tree6b676800286705c8fd486a5163d5ea330e6e3a96 /pkg/bindings
parent1d14e6ed3c49777bc2b35e7c49d9232b2810935e (diff)
parentf7d82a1f30d31830de18da14c61e85d2a0688605 (diff)
downloadpodman-989c8e97851c1a443270e803e19dd069fc199302.tar.gz
podman-989c8e97851c1a443270e803e19dd069fc199302.tar.bz2
podman-989c8e97851c1a443270e803e19dd069fc199302.zip
Merge pull request #9863 from jmguzik/fix-prune-filter-funcs
Containers prune endpoint should use only prune filters
Diffstat (limited to 'pkg/bindings')
-rw-r--r--pkg/bindings/test/containers_test.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/pkg/bindings/test/containers_test.go b/pkg/bindings/test/containers_test.go
index b0ddc7862..cb9e0721b 100644
--- a/pkg/bindings/test/containers_test.go
+++ b/pkg/bindings/test/containers_test.go
@@ -550,21 +550,28 @@ var _ = Describe("Podman containers ", func() {
filtersIncorrect := map[string][]string{
"status": {"dummy"},
}
- pruneResponse, err := containers.Prune(bt.conn, new(containers.PruneOptions).WithFilters(filtersIncorrect))
+ _, err = containers.Prune(bt.conn, new(containers.PruneOptions).WithFilters(filtersIncorrect))
+ Expect(err).ToNot(BeNil())
+
+ // List filter params should not work with prune.
+ filtersIncorrect = map[string][]string{
+ "name": {"top"},
+ }
+ _, err = containers.Prune(bt.conn, new(containers.PruneOptions).WithFilters(filtersIncorrect))
Expect(err).ToNot(BeNil())
// Mismatched filter params no container should be pruned.
filtersIncorrect = map[string][]string{
- "name": {"r"},
+ "label": {"xyz"},
}
- pruneResponse, err = containers.Prune(bt.conn, new(containers.PruneOptions).WithFilters(filtersIncorrect))
+ pruneResponse, err := containers.Prune(bt.conn, new(containers.PruneOptions).WithFilters(filtersIncorrect))
Expect(err).To(BeNil())
Expect(len(reports.PruneReportsIds(pruneResponse))).To(Equal(0))
Expect(len(reports.PruneReportsErrs(pruneResponse))).To(Equal(0))
// Valid filter params container should be pruned now.
filters := map[string][]string{
- "name": {"top"},
+ "until": {"0s"},
}
pruneResponse, err = containers.Prune(bt.conn, new(containers.PruneOptions).WithFilters(filters))
Expect(err).To(BeNil())