diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-07-15 10:37:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-15 10:37:11 -0400 |
commit | bc98c2003d36f9ce5650c1e0f4445be97ca0fa18 (patch) | |
tree | 9c3a777a89c015266578b7349a0f1233c2f325d0 /test/e2e/pod_kill_test.go | |
parent | 47f351769bbf9e06ec47d340943e5a494d586e79 (diff) | |
parent | 547fff27033a294d1639ee3f9125f775032f39f5 (diff) | |
download | podman-bc98c2003d36f9ce5650c1e0f4445be97ca0fa18.tar.gz podman-bc98c2003d36f9ce5650c1e0f4445be97ca0fa18.tar.bz2 podman-bc98c2003d36f9ce5650c1e0f4445be97ca0fa18.zip |
Merge pull request #10932 from edsantiago/e2e_exit_checks
e2e tests: use Should(Exit()) and ExitWithError()
Diffstat (limited to 'test/e2e/pod_kill_test.go')
-rw-r--r-- | test/e2e/pod_kill_test.go | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/test/e2e/pod_kill_test.go b/test/e2e/pod_kill_test.go index 92dcad292..7ab62ec5d 100644 --- a/test/e2e/pod_kill_test.go +++ b/test/e2e/pod_kill_test.go @@ -7,6 +7,7 @@ import ( . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gexec" ) var _ = Describe("Podman pod kill", func() { @@ -45,15 +46,15 @@ var _ = Describe("Podman pod kill", func() { session := podmanTest.RunTopContainerInPod("", podid) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) session = podmanTest.RunTopContainerInPod("", podid) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) result := podmanTest.Podman([]string{"pod", "kill", podid}) result.WaitWithDefaultTimeout() - Expect(result.ExitCode()).To(Equal(0)) + Expect(result).Should(Exit(0)) Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) }) @@ -63,11 +64,11 @@ var _ = Describe("Podman pod kill", func() { session := podmanTest.RunTopContainerInPod("", podid) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) result := podmanTest.Podman([]string{"pod", "kill", "-s", "9", podid}) result.WaitWithDefaultTimeout() - Expect(result.ExitCode()).To(Equal(0)) + Expect(result).Should(Exit(0)) Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) }) @@ -77,11 +78,11 @@ var _ = Describe("Podman pod kill", func() { session := podmanTest.RunTopContainerInPod("", podid) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) result := podmanTest.Podman([]string{"pod", "kill", "test1"}) result.WaitWithDefaultTimeout() - Expect(result.ExitCode()).To(Equal(0)) + Expect(result).Should(Exit(0)) Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) }) @@ -91,11 +92,11 @@ var _ = Describe("Podman pod kill", func() { session := podmanTest.RunTopContainerInPod("", podid) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) result := podmanTest.Podman([]string{"pod", "kill", "-s", "bogus", "test1"}) result.WaitWithDefaultTimeout() - Expect(result.ExitCode()).To(Equal(125)) + Expect(result).Should(Exit(125)) Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1)) }) @@ -105,24 +106,24 @@ var _ = Describe("Podman pod kill", func() { session := podmanTest.RunTopContainerInPod("", podid) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) _, ec, podid2 := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session = podmanTest.RunTopContainerInPod("", podid2) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) session = podmanTest.RunTopContainerInPod("", podid2) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) if !IsRemote() { podid2 = "-l" } result := podmanTest.Podman([]string{"pod", "kill", podid2}) result.WaitWithDefaultTimeout() - Expect(result.ExitCode()).To(Equal(0)) + Expect(result).Should(Exit(0)) Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1)) }) @@ -133,23 +134,23 @@ var _ = Describe("Podman pod kill", func() { session := podmanTest.RunTopContainerInPod("", podid) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) session = podmanTest.RunTopContainerInPod("", podid) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) _, ec, podid2 := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session = podmanTest.RunTopContainerInPod("", podid2) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) result := podmanTest.Podman([]string{"pod", "kill", "-a"}) result.WaitWithDefaultTimeout() fmt.Println(result.OutputToString(), result.ErrorToString()) - Expect(result.ExitCode()).To(Equal(0)) + Expect(result).Should(Exit(0)) Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) }) }) |