From 5405b4f279adc2aa8e0532acf921828890f3d258 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Tue, 23 Apr 2019 13:09:22 -0400 Subject: Add extra CI tests for stopping all containers We weren't testing cases where not all containers were running when stop --all ran. Signed-off-by: Matthew Heon --- test/e2e/stop_test.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'test/e2e/stop_test.go') diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go index 97c9287b9..61c3fedfd 100644 --- a/test/e2e/stop_test.go +++ b/test/e2e/stop_test.go @@ -141,4 +141,40 @@ var _ = Describe("Podman stop", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) }) + + It("podman stop all containers with one stopped", func() { + session := podmanTest.RunTopContainer("test1") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + session2 := podmanTest.RunTopContainer("test1") + session2.WaitWithDefaultTimeout() + Expect(session2.ExitCode()).To(Equal(0)) + session3 := podmanTest.Podman([]string("stop", "-l", "-t", "1")) + session3.WaitWithDefaultTimeout() + Expect(session3.ExitCode()).To(Equal(0)) + session4 := podmanTest.Podman([]string("stop", "-a", "-t", "1")) + session4.WaitWithDefaultTimeout() + Expect(session4.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 created", func() { + session := podmanTest.RunTopContainer("test1") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + session2 := podmanTest.Podman([]string{"create", ALPINE, "/bin/sh"}) + session2.WaitWithDefaultTimeout() + Expect(session2.ExitCode()).To(Equal(0)) + session3 := podmanTest.Podman([]string("stop", "-a", "-t", "1")) + 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("")) + }) + }) -- cgit v1.2.3-54-g00ecf