From 5047c79e71a336da1fa2e0b8fc6e50811801f878 Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Thu, 18 Jul 2019 13:10:37 -0400 Subject: support podman ps filter regular expressions podman ps --filter use regexp to match the container name. Signed-off-by: Qi Wang --- test/e2e/ps_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test') diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index 2b86f663f..efcf44f76 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -332,4 +332,30 @@ var _ = Describe("Podman ps", func() { Expect(result.ExitCode()).To(Equal(0)) Expect(result.OutputToStringArray()[0]).To(Equal(fullCid)) }) + + It("podman ps filter name regexp", func() { + session := podmanTest.Podman([]string{"run", "-d", "--name", "test1", ALPINE, "top"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + fullCid := session.OutputToString() + + session2 := podmanTest.Podman([]string{"run", "-d", "--name", "test11", ALPINE, "top"}) + session2.WaitWithDefaultTimeout() + Expect(session2.ExitCode()).To(Equal(0)) + + result := podmanTest.Podman([]string{"ps", "-aq", "--no-trunc", "--filter", "name=test1"}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(0)) + + output := result.OutputToStringArray() + Expect(len(output)).To(Equal(2)) + + result = podmanTest.Podman([]string{"ps", "-aq", "--no-trunc", "--filter", "name=test1$"}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(0)) + + output = result.OutputToStringArray() + Expect(len(output)).To(Equal(1)) + Expect(output[0]).To(Equal(fullCid)) + }) }) -- cgit v1.2.3-54-g00ecf