From 2bc6427302eb6bcbd613d7ee767080d278968490 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Fri, 24 Aug 2018 17:39:37 -0400 Subject: Fix handling of multiple filters in podman ps Docker expects multiple filters to be passed with multiple uses of the --filter flag (e.g. --filter=label=a=b --filter=label=c=d) and not a single comma-separated list of filters as we expected. Convert to the Docker format, and make some small cleanups to our handling of filters along the way. Signed-off-by: Matthew Heon Closes: #1345 Approved by: umohnani8 --- test/e2e/ps_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test') diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index f5d79193b..a873b57bb 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -181,6 +181,25 @@ var _ = Describe("Podman ps", func() { Expect(result.OutputToStringArray()[0]).To(Equal(fullCid)) }) + It("podman ps multiple filters", func() { + session := podmanTest.Podman([]string{"run", "-d", "--name", "test1", "--label", "key1=value1", ALPINE, "top"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + fullCid := session.OutputToString() + + session2 := podmanTest.Podman([]string{"run", "-d", "--name", "test2", "--label", "key1=value1", ALPINE, "top"}) + session2.WaitWithDefaultTimeout() + Expect(session2.ExitCode()).To(Equal(0)) + + result := podmanTest.Podman([]string{"ps", "-aq", "--no-trunc", "--filter", "name=test1", "--filter", "label=key1=value1"}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(0)) + + output := result.OutputToStringArray() + Expect(len(output)).To(Equal(1)) + Expect(output[0]).To(Equal(fullCid)) + }) + It("podman ps mutually exclusive flags", func() { session := podmanTest.Podman([]string{"ps", "-aqs"}) session.WaitWithDefaultTimeout() -- cgit v1.2.3-54-g00ecf