summaryrefslogtreecommitdiff
path: root/test/e2e/volume_rm_test.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-07-15 10:37:11 -0400
committerGitHub <noreply@github.com>2021-07-15 10:37:11 -0400
commitbc98c2003d36f9ce5650c1e0f4445be97ca0fa18 (patch)
tree9c3a777a89c015266578b7349a0f1233c2f325d0 /test/e2e/volume_rm_test.go
parent47f351769bbf9e06ec47d340943e5a494d586e79 (diff)
parent547fff27033a294d1639ee3f9125f775032f39f5 (diff)
downloadpodman-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/volume_rm_test.go')
-rw-r--r--test/e2e/volume_rm_test.go37
1 files changed, 19 insertions, 18 deletions
diff --git a/test/e2e/volume_rm_test.go b/test/e2e/volume_rm_test.go
index 883a503c4..b979444bc 100644
--- a/test/e2e/volume_rm_test.go
+++ b/test/e2e/volume_rm_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 volume rm", func() {
@@ -35,15 +36,15 @@ var _ = Describe("Podman volume rm", func() {
It("podman volume rm", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "rm", "myvol"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
})
@@ -51,20 +52,20 @@ var _ = Describe("Podman volume rm", func() {
session := podmanTest.Podman([]string{"create", "-v", "myvol:/myvol", ALPINE, "ls"})
cid := session.OutputToString()
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "rm", "myvol"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(2))
+ Expect(session).Should(Exit(2))
Expect(session.ErrorToString()).To(ContainSubstring(cid))
session = podmanTest.Podman([]string{"volume", "rm", "-f", "myvol"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
podmanTest.Cleanup()
@@ -73,51 +74,51 @@ var _ = Describe("Podman volume rm", func() {
It("podman volume remove bogus", func() {
session := podmanTest.Podman([]string{"volume", "rm", "bogus"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(1))
+ Expect(session).Should(Exit(1))
})
It("podman rm with --all flag", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "rm", "-a"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
})
It("podman volume rm by partial name", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "rm", "myv"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
})
It("podman volume rm by nonunique partial name", func() {
session := podmanTest.Podman([]string{"volume", "create", "myvol1"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "create", "myvol2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "rm", "myv"})
session.WaitWithDefaultTimeout()
@@ -125,7 +126,7 @@ var _ = Describe("Podman volume rm", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray()) >= 2).To(BeTrue())
})
})