From 0dad2499a33e3d76eb4508a52c7449224ee1e10b Mon Sep 17 00:00:00 2001 From: Anders F Björklund Date: Sat, 14 Nov 2020 20:10:57 +0100 Subject: Add support for volume ls --filter label=key=value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Supposed to be able to search for labels with a given value. Previously it meant searching for label key and label value: --filter label=key --filter label=value Add some documentation and integration tests for it as well. Signed-off-by: Anders F Björklund --- test/e2e/volume_ls_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/e2e/volume_ls_test.go') diff --git a/test/e2e/volume_ls_test.go b/test/e2e/volume_ls_test.go index cda118bf1..5c466124d 100644 --- a/test/e2e/volume_ls_test.go +++ b/test/e2e/volume_ls_test.go @@ -83,6 +83,22 @@ var _ = Describe("Podman volume ls", func() { Expect(session.ExitCode()).To(Equal(0)) Expect(len(session.OutputToStringArray())).To(Equal(2)) Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName)) + + session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=foo"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(0)) + + session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=bar"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(2)) + Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName)) + + session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=baz"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(0)) }) It("podman volume ls with --filter dangling", func() { @@ -132,5 +148,11 @@ var _ = Describe("Podman volume ls", func() { Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName)) Expect(session.OutputToStringArray()[2]).To(ContainSubstring(anotherVol)) + session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=bar", "--filter", "label=foo2=bar2"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(3)) + Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName)) + Expect(session.OutputToStringArray()[2]).To(ContainSubstring(anotherVol)) }) }) -- cgit v1.2.3-54-g00ecf