summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-28 14:54:45 -0400
committerGitHub <noreply@github.com>2020-05-28 14:54:45 -0400
commite8818ced806910f8ce44939fef08f89139be4119 (patch)
treeed694b8cf97e56dee0de11e64e622cb821821c47 /test
parent4b2c980e0f74abd480d5c8213e9cd416108d5169 (diff)
parentd6469c9c9b88cf206b24a99a764ebfbc82d217b7 (diff)
downloadpodman-e8818ced806910f8ce44939fef08f89139be4119.tar.gz
podman-e8818ced806910f8ce44939fef08f89139be4119.tar.bz2
podman-e8818ced806910f8ce44939fef08f89139be4119.zip
Merge pull request #6416 from vrothberg/fix-ps-last
fix `ps --last=N`
Diffstat (limited to 'test')
-rw-r--r--test/e2e/ps_test.go25
1 files changed, 23 insertions, 2 deletions
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index 8965ce297..12ce4661f 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -114,6 +114,17 @@ var _ = Describe("Podman ps", func() {
It("podman ps last flag", func() {
Skip("--last flag nonfunctional and disabled")
+ // Make sure that non-running containers are being counted as
+ // well.
+ session := podmanTest.Podman([]string{"create", "alpine", "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ result := podmanTest.Podman([]string{"ps", "--last", "2"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(len(result.OutputToStringArray())).Should(Equal(2)) // 1 container
+
_, ec, _ := podmanTest.RunLsContainer("test1")
Expect(ec).To(Equal(0))
@@ -123,10 +134,20 @@ var _ = Describe("Podman ps", func() {
_, ec, _ = podmanTest.RunLsContainer("test3")
Expect(ec).To(Equal(0))
- result := podmanTest.Podman([]string{"ps", "--last", "2"})
+ result = podmanTest.Podman([]string{"ps", "--last", "2"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(len(result.OutputToStringArray())).Should(Equal(3)) // 2 containers
+
+ result = podmanTest.Podman([]string{"ps", "--last", "3"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(len(result.OutputToStringArray())).Should(Equal(4)) // 3 containers
+
+ result = podmanTest.Podman([]string{"ps", "--last", "100"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
- Expect(len(result.OutputToStringArray())).Should(Equal(3))
+ Expect(len(result.OutputToStringArray())).Should(Equal(5)) // 4 containers (3 running + 1 created)
})
It("podman ps no-trunc", func() {