diff options
author | Jakub Guzik <jakubmguzik@gmail.com> | 2021-03-30 10:19:22 +0200 |
---|---|---|
committer | Jakub Guzik <jakubmguzik@gmail.com> | 2021-03-30 10:19:22 +0200 |
commit | f7d82a1f30d31830de18da14c61e85d2a0688605 (patch) | |
tree | 86be25e45d7564afc183e43df0ce5c4d3a12135b /pkg/bindings/test/containers_test.go | |
parent | 08eab3f8f77d8206e3c788fa0a8f455ef854db1c (diff) | |
download | podman-f7d82a1f30d31830de18da14c61e85d2a0688605.tar.gz podman-f7d82a1f30d31830de18da14c61e85d2a0688605.tar.bz2 podman-f7d82a1f30d31830de18da14c61e85d2a0688605.zip |
Containers prune endpoint should use only prune filters
Containers endpoints for HTTP compad and libpod APIs allowed usage of list HTTP
endpoint filter funcs. Documentation in case of libpod and compat API does not allow that.
This commit aligns code with the documentation.
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
Diffstat (limited to 'pkg/bindings/test/containers_test.go')
-rw-r--r-- | pkg/bindings/test/containers_test.go | 15 |
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()) |