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_inspect_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_inspect_test.go')
-rw-r--r-- | test/e2e/pod_inspect_test.go | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/test/e2e/pod_inspect_test.go b/test/e2e/pod_inspect_test.go index 036b08570..6633b228c 100644 --- a/test/e2e/pod_inspect_test.go +++ b/test/e2e/pod_inspect_test.go @@ -8,6 +8,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 inspect", func() { @@ -46,15 +47,15 @@ var _ = Describe("Podman pod inspect", 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)) inspect := podmanTest.Podman([]string{"pod", "inspect", podid}) inspect.WaitWithDefaultTimeout() - Expect(inspect.ExitCode()).To(Equal(0)) + Expect(inspect).Should(Exit(0)) Expect(inspect.IsJSONOutputValid()).To(BeTrue()) podData := inspect.InspectPodToJSON() Expect(podData.ID).To(Equal(podid)) @@ -67,13 +68,13 @@ var _ = Describe("Podman pod inspect", func() { // Create the pod. session := podmanTest.Podman(createCommand) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) // Inspect the pod and make sure that the create command is // exactly how we created the pod. inspect := podmanTest.Podman([]string{"pod", "inspect", podName}) inspect.WaitWithDefaultTimeout() - Expect(inspect.ExitCode()).To(Equal(0)) + Expect(inspect).Should(Exit(0)) Expect(inspect.IsJSONOutputValid()).To(BeTrue()) podData := inspect.InspectPodToJSON() // Let's get the last len(createCommand) items in the command. @@ -86,11 +87,11 @@ var _ = Describe("Podman pod inspect", func() { podName := "testPod" create := podmanTest.Podman([]string{"pod", "create", "--name", podName, "-p", "8080:80"}) create.WaitWithDefaultTimeout() - Expect(create.ExitCode()).To(Equal(0)) + Expect(create).Should(Exit(0)) inspectOut := podmanTest.Podman([]string{"pod", "inspect", podName}) inspectOut.WaitWithDefaultTimeout() - Expect(inspectOut.ExitCode()).To(Equal(0)) + Expect(inspectOut).Should(Exit(0)) inspectJSON := new(define.InspectPodData) err := json.Unmarshal(inspectOut.Out.Contents(), inspectJSON) @@ -106,15 +107,15 @@ var _ = Describe("Podman pod inspect", func() { macAddr := "42:43:44:00:00:01" create := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--mac-address", macAddr}) create.WaitWithDefaultTimeout() - Expect(create.ExitCode()).To(Equal(0)) + Expect(create).Should(Exit(0)) create = podmanTest.Podman([]string{"run", "-d", "--pod", podName, ALPINE, "top"}) create.WaitWithDefaultTimeout() - Expect(create.ExitCode()).To(Equal(0)) + Expect(create).Should(Exit(0)) inspectOut := podmanTest.Podman([]string{"pod", "inspect", podName}) inspectOut.WaitWithDefaultTimeout() - Expect(inspectOut.ExitCode()).To(Equal(0)) + Expect(inspectOut).Should(Exit(0)) Expect(inspectOut.OutputToString()).To(ContainSubstring(macAddr)) }) |