summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-12-23 04:42:30 -0500
committerGitHub <noreply@github.com>2020-12-23 04:42:30 -0500
commit767e1ac17fe093b1c1bf7525e95dd162c55a490a (patch)
treeff4605818e6ac237ab0efefd645599220831b88a /test/e2e
parent9b6324f51f7279683f2d2a6c90542029e1ded1ee (diff)
parentc50c75419b80791d6dd086ced608c41b2f3d96b6 (diff)
downloadpodman-767e1ac17fe093b1c1bf7525e95dd162c55a490a.tar.gz
podman-767e1ac17fe093b1c1bf7525e95dd162c55a490a.tar.bz2
podman-767e1ac17fe093b1c1bf7525e95dd162c55a490a.zip
Merge pull request #8804 from baude/issue8512
add pod filter for ps
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/ps_test.go51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index 05571157c..0c5d817ba 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -673,4 +673,55 @@ var _ = Describe("Podman ps", func() {
Expect(session.LineInOutputContains("test3")).To(BeTrue())
Expect(session.LineInOutputContains("test4")).To(BeTrue())
})
+ It("podman ps filter pod", func() {
+ pod1 := podmanTest.Podman([]string{"pod", "create", "--name", "pod1"})
+ pod1.WaitWithDefaultTimeout()
+ Expect(pod1.ExitCode()).To(BeZero())
+ con1 := podmanTest.Podman([]string{"run", "-dt", "--pod", "pod1", ALPINE, "top"})
+ con1.WaitWithDefaultTimeout()
+ Expect(con1.ExitCode()).To(BeZero())
+
+ pod2 := podmanTest.Podman([]string{"pod", "create", "--name", "pod2"})
+ pod2.WaitWithDefaultTimeout()
+ Expect(pod2.ExitCode()).To(BeZero())
+ con2 := podmanTest.Podman([]string{"run", "-dt", "--pod", "pod2", ALPINE, "top"})
+ con2.WaitWithDefaultTimeout()
+ Expect(con2.ExitCode()).To(BeZero())
+
+ // bogus pod name or id should not result in error
+ session := podmanTest.Podman([]string{"ps", "--filter", "pod=1234"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+
+ // filter by pod name
+ session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=pod1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(StringInSlice(pod1.OutputToString(), session.OutputToStringArray()))
+
+ // filter by full pod id
+ session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=" + pod1.OutputToString()})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(StringInSlice(pod1.OutputToString(), session.OutputToStringArray()))
+
+ // filter by partial pod id
+ session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=" + pod1.OutputToString()[0:12]})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(StringInSlice(pod1.OutputToString(), session.OutputToStringArray()))
+
+ // filter by multiple pods is inclusive
+ session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=pod1", "--filter", "pod=pod2"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ Expect(len(session.OutputToStringArray())).To(Equal(4))
+ Expect(StringInSlice(pod1.OutputToString(), session.OutputToStringArray()))
+ Expect(StringInSlice(pod2.OutputToString(), session.OutputToStringArray()))
+
+ })
+
})