diff options
Diffstat (limited to 'test/e2e/port_test.go')
-rw-r--r-- | test/e2e/port_test.go | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/test/e2e/port_test.go b/test/e2e/port_test.go index e9bbc2adc..e5c7576ae 100644 --- a/test/e2e/port_test.go +++ b/test/e2e/port_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 port", func() { @@ -48,7 +49,7 @@ var _ = Describe("Podman port", func() { It("podman port -l nginx", func() { session, cid := podmanTest.RunNginxWithHealthCheck("test1") - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) if err := podmanTest.RunHealthCheck(cid); err != nil { Fail(err.Error()) @@ -59,14 +60,14 @@ var _ = Describe("Podman port", func() { } result := podmanTest.Podman([]string{"port", cid}) result.WaitWithDefaultTimeout() - Expect(result.ExitCode()).To(Equal(0)) + Expect(result).Should(Exit(0)) port := strings.Split(result.OutputToStringArray()[0], ":")[1] Expect(result.LineInOutputStartsWith(fmt.Sprintf("80/tcp -> 0.0.0.0:%s", port))).To(BeTrue()) }) It("podman container port -l nginx", func() { session, cid := podmanTest.RunNginxWithHealthCheck("") - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) if err := podmanTest.RunHealthCheck(cid); err != nil { Fail(err.Error()) @@ -77,14 +78,14 @@ var _ = Describe("Podman port", func() { } result := podmanTest.Podman([]string{"container", "port", cid}) result.WaitWithDefaultTimeout() - Expect(result.ExitCode()).To(Equal(0)) + Expect(result).Should(Exit(0)) port := strings.Split(result.OutputToStringArray()[0], ":")[1] Expect(result.LineInOutputStartsWith(fmt.Sprintf("80/tcp -> 0.0.0.0:%s", port))).To(BeTrue()) }) It("podman port -l port nginx", func() { session, cid := podmanTest.RunNginxWithHealthCheck("") - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) if err := podmanTest.RunHealthCheck(cid); err != nil { Fail(err.Error()) @@ -95,14 +96,14 @@ var _ = Describe("Podman port", func() { } result := podmanTest.Podman([]string{"port", cid, "80"}) result.WaitWithDefaultTimeout() - Expect(result.ExitCode()).To(Equal(0)) + Expect(result).Should(Exit(0)) port := strings.Split(result.OutputToStringArray()[0], ":")[1] Expect(result.LineInOutputStartsWith(fmt.Sprintf("0.0.0.0:%s", port))).To(BeTrue()) }) It("podman port -a nginx", func() { session, cid := podmanTest.RunNginxWithHealthCheck("") - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) if err := podmanTest.RunHealthCheck(cid); err != nil { Fail(err.Error()) @@ -110,12 +111,12 @@ var _ = Describe("Podman port", func() { result := podmanTest.Podman([]string{"port", "-a"}) result.WaitWithDefaultTimeout() - Expect(result.ExitCode()).To(Equal(0)) + Expect(result).Should(Exit(0)) }) It("podman port nginx by name", func() { session, cid := podmanTest.RunNginxWithHealthCheck("portcheck") - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) if err := podmanTest.RunHealthCheck(cid); err != nil { Fail(err.Error()) @@ -123,7 +124,7 @@ var _ = Describe("Podman port", func() { result := podmanTest.Podman([]string{"port", "portcheck"}) result.WaitWithDefaultTimeout() - Expect(result.ExitCode()).To(Equal(0)) + Expect(result).Should(Exit(0)) result.LineInOutputStartsWith("80/tcp -> 0.0.0.0:") }) @@ -136,18 +137,18 @@ var _ = Describe("Podman port", func() { setup := podmanTest.Podman([]string{"run", "--name", "test", "-dt", "-p", "5000:5000", "-p", "5001:5001", ALPINE, "top"}) setup.WaitWithDefaultTimeout() - Expect(setup.ExitCode()).To(BeZero()) + Expect(setup).Should(Exit(0)) // Check that the first port was honored result1 := podmanTest.Podman([]string{"port", "test", "5000"}) result1.WaitWithDefaultTimeout() - Expect(result1.ExitCode()).To(BeZero()) + Expect(result1).Should(Exit(0)) Expect(result1.LineInOutputStartsWith("0.0.0.0:5000")).To(BeTrue()) // Check that the second port was honored result2 := podmanTest.Podman([]string{"port", "test", "5001"}) result2.WaitWithDefaultTimeout() - Expect(result2.ExitCode()).To(BeZero()) + Expect(result2).Should(Exit(0)) Expect(result2.LineInOutputStartsWith("0.0.0.0:5001")).To(BeTrue()) }) }) |