summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2019-04-23 13:11:35 -0400
committerMatthew Heon <mheon@redhat.com>2019-04-24 12:51:41 -0400
commit597b2ebfeaeb1c2aec6790d5e3351a8889e2dc46 (patch)
tree2eb1cfd5721fa3b65038d53191fc84fd01b37cc4 /test
parent5405b4f279adc2aa8e0532acf921828890f3d258 (diff)
downloadpodman-597b2ebfeaeb1c2aec6790d5e3351a8889e2dc46.tar.gz
podman-597b2ebfeaeb1c2aec6790d5e3351a8889e2dc46.tar.bz2
podman-597b2ebfeaeb1c2aec6790d5e3351a8889e2dc46.zip
Enhance tests for stop to check results
None of the stop tests actually verified that containers were in a stopped state after they finished. We shouldn't take a 0 exit code to indicate that things worked - verify that ps shows no running containers. Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/stop_test.go41
1 files changed, 40 insertions, 1 deletions
diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go
index 61c3fedfd..259410736 100644
--- a/test/e2e/stop_test.go
+++ b/test/e2e/stop_test.go
@@ -48,6 +48,11 @@ var _ = Describe("Podman stop", func() {
session = podmanTest.Podman([]string{"stop", cid})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
+
+ finalCtrs := podmanTest.Podman([]string("ps", "-q"))
+ finalCtrs.WaitWithDefaultTimeout()
+ Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs.OutputToString()).To(Equal(""))
})
It("podman stop container by name", func() {
@@ -57,15 +62,25 @@ var _ = Describe("Podman stop", func() {
session = podmanTest.Podman([]string{"stop", "test1"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
+
+ finalCtrs := podmanTest.Podman([]string("ps", "-q"))
+ finalCtrs.WaitWithDefaultTimeout()
+ Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs.OutputToString()).To(Equal(""))
})
- It("podman stop container by name", func() {
+ It("podman container stop by name", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.Podman([]string{"container", "stop", "test1"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
+
+ finalCtrs := podmanTest.Podman([]string("ps", "-q"))
+ finalCtrs.WaitWithDefaultTimeout()
+ Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs.OutputToString()).To(Equal(""))
})
It("podman stop stopped container", func() {
@@ -80,6 +95,11 @@ var _ = Describe("Podman stop", func() {
session3 := podmanTest.Podman([]string{"stop", "test1"})
session3.WaitWithDefaultTimeout()
Expect(session3.ExitCode()).To(Equal(0))
+
+ finalCtrs := podmanTest.Podman([]string("ps", "-q"))
+ finalCtrs.WaitWithDefaultTimeout()
+ Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs.OutputToString()).To(Equal(""))
})
It("podman stop all containers -t", func() {
@@ -105,6 +125,11 @@ var _ = Describe("Podman stop", func() {
Expect(output).To(ContainSubstring(cid1))
Expect(output).To(ContainSubstring(cid2))
Expect(output).To(ContainSubstring(cid3))
+
+ finalCtrs := podmanTest.Podman([]string("ps", "-q"))
+ finalCtrs.WaitWithDefaultTimeout()
+ Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs.OutputToString()).To(Equal(""))
})
It("podman stop container --time", func() {
@@ -118,6 +143,11 @@ var _ = Describe("Podman stop", func() {
Expect(session.ExitCode()).To(Equal(0))
output := session.OutputToString()
Expect(output).To(ContainSubstring(cid1))
+
+ finalCtrs := podmanTest.Podman([]string("ps", "-q"))
+ finalCtrs.WaitWithDefaultTimeout()
+ Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs.OutputToString()).To(Equal(""))
})
It("podman stop container --timeout", func() {
@@ -131,6 +161,11 @@ var _ = Describe("Podman stop", func() {
Expect(session.ExitCode()).To(Equal(0))
output := session.OutputToString()
Expect(output).To(ContainSubstring(cid1))
+
+ finalCtrs := podmanTest.Podman([]string("ps", "-q"))
+ finalCtrs.WaitWithDefaultTimeout()
+ Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs.OutputToString()).To(Equal(""))
})
It("podman stop latest containers", func() {
@@ -140,6 +175,10 @@ var _ = Describe("Podman stop", func() {
session = podmanTest.Podman([]string{"stop", "-l", "-t", "1"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
+ finalCtrs := podmanTest.Podman([]string("ps", "-q"))
+ finalCtrs.WaitWithDefaultTimeout()
+ Expect(finalCtrs.ExitCode()).To(Equal(0))
+ Expect(finalCtrs.OutputToString()).To(Equal(""))
})
It("podman stop all containers with one stopped", func() {