diff options
Diffstat (limited to 'test/e2e/init_test.go')
-rw-r--r-- | test/e2e/init_test.go | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/test/e2e/init_test.go b/test/e2e/init_test.go index d283e1f9a..788b67154 100644 --- a/test/e2e/init_test.go +++ b/test/e2e/init_test.go @@ -6,6 +6,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 init", func() { @@ -35,26 +36,26 @@ var _ = Describe("Podman init", func() { It("podman init bogus container", func() { session := podmanTest.Podman([]string{"start", "123456"}) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(125)) + Expect(session).Should(Exit(125)) }) It("podman init with no arguments", func() { session := podmanTest.Podman([]string{"start"}) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(125)) + Expect(session).Should(Exit(125)) }) It("podman init single container by ID", func() { session := podmanTest.Podman([]string{"create", ALPINE, "ls"}) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) cid := session.OutputToString() init := podmanTest.Podman([]string{"init", cid}) init.WaitWithDefaultTimeout() - Expect(init.ExitCode()).To(Equal(0)) + Expect(init).Should(Exit(0)) result := podmanTest.Podman([]string{"inspect", cid}) result.WaitWithDefaultTimeout() - Expect(result.ExitCode()).To(Equal(0)) + Expect(result).Should(Exit(0)) conData := result.InspectContainerToJSON() Expect(conData[0].State.Status).To(Equal("created")) }) @@ -63,13 +64,13 @@ var _ = Describe("Podman init", func() { name := "test1" session := podmanTest.Podman([]string{"create", "--name", name, ALPINE, "ls"}) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) init := podmanTest.Podman([]string{"init", name}) init.WaitWithDefaultTimeout() - Expect(init.ExitCode()).To(Equal(0)) + Expect(init).Should(Exit(0)) result := podmanTest.Podman([]string{"inspect", name}) result.WaitWithDefaultTimeout() - Expect(result.ExitCode()).To(Equal(0)) + Expect(result).Should(Exit(0)) conData := result.InspectContainerToJSON() Expect(conData[0].State.Status).To(Equal("created")) }) @@ -78,13 +79,13 @@ var _ = Describe("Podman init", func() { SkipIfRemote("--latest flag n/a") session := podmanTest.Podman([]string{"create", ALPINE, "ls"}) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) init := podmanTest.Podman([]string{"init", "--latest"}) init.WaitWithDefaultTimeout() - Expect(init.ExitCode()).To(Equal(0)) + Expect(init).Should(Exit(0)) result := podmanTest.Podman([]string{"inspect", "--latest"}) result.WaitWithDefaultTimeout() - Expect(result.ExitCode()).To(Equal(0)) + Expect(result).Should(Exit(0)) conData := result.InspectContainerToJSON() Expect(conData[0].State.Status).To(Equal("created")) }) @@ -92,29 +93,29 @@ var _ = Describe("Podman init", func() { It("podman init all three containers, one running", func() { session := podmanTest.Podman([]string{"create", "--name", "test1", ALPINE, "ls"}) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) session2 := podmanTest.Podman([]string{"create", "--name", "test2", ALPINE, "ls"}) session2.WaitWithDefaultTimeout() - Expect(session2.ExitCode()).To(Equal(0)) + Expect(session2).Should(Exit(0)) session3 := podmanTest.Podman([]string{"run", "--name", "test3", "-d", ALPINE, "top"}) session3.WaitWithDefaultTimeout() - Expect(session3.ExitCode()).To(Equal(0)) + Expect(session3).Should(Exit(0)) init := podmanTest.Podman([]string{"init", "--all"}) init.WaitWithDefaultTimeout() - Expect(init.ExitCode()).To(Equal(0)) + Expect(init).Should(Exit(0)) result := podmanTest.Podman([]string{"inspect", "test1"}) result.WaitWithDefaultTimeout() - Expect(result.ExitCode()).To(Equal(0)) + Expect(result).Should(Exit(0)) conData := result.InspectContainerToJSON() Expect(conData[0].State.Status).To(Equal("created")) result2 := podmanTest.Podman([]string{"inspect", "test2"}) result2.WaitWithDefaultTimeout() - Expect(result2.ExitCode()).To(Equal(0)) + Expect(result2).Should(Exit(0)) conData2 := result2.InspectContainerToJSON() Expect(conData2[0].State.Status).To(Equal("created")) result3 := podmanTest.Podman([]string{"inspect", "test3"}) result3.WaitWithDefaultTimeout() - Expect(result3.ExitCode()).To(Equal(0)) + Expect(result3).Should(Exit(0)) conData3 := result3.InspectContainerToJSON() Expect(conData3[0].State.Status).To(Equal("running")) }) @@ -122,9 +123,9 @@ var _ = Describe("Podman init", func() { It("podman init running container errors", func() { session := podmanTest.Podman([]string{"run", "--name", "init_test", "-d", ALPINE, "top"}) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) init := podmanTest.Podman([]string{"init", "init_test"}) init.WaitWithDefaultTimeout() - Expect(init.ExitCode()).To(Equal(125)) + Expect(init).Should(Exit(125)) }) }) |