summaryrefslogtreecommitdiff
path: root/test/e2e/run_apparmor_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/run_apparmor_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/run_apparmor_test.go')
-rw-r--r--test/e2e/run_apparmor_test.go21
1 files changed, 11 insertions, 10 deletions
diff --git a/test/e2e/run_apparmor_test.go b/test/e2e/run_apparmor_test.go
index 1f9b9bc90..6532402ed 100644
--- a/test/e2e/run_apparmor_test.go
+++ b/test/e2e/run_apparmor_test.go
@@ -12,6 +12,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
// wip
@@ -54,7 +55,7 @@ var _ = Describe("Podman run", func() {
skipIfAppArmorDisabled()
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
@@ -66,7 +67,7 @@ var _ = Describe("Podman run", func() {
skipIfAppArmorDisabled()
session := podmanTest.Podman([]string{"create", "--privileged", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
@@ -78,7 +79,7 @@ var _ = Describe("Podman run", func() {
skipIfAppArmorDisabled()
session := podmanTest.Podman([]string{"create", "--security-opt", fmt.Sprintf("apparmor=%s", apparmor.Profile), "--privileged", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
@@ -105,11 +106,11 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
aaFile := filepath.Join(os.TempDir(), "aaFile")
Expect(ioutil.WriteFile(aaFile, []byte(aaProfile), 0755)).To(BeNil())
parse := SystemExec("apparmor_parser", []string{"-Kr", aaFile})
- Expect(parse.ExitCode()).To(Equal(0))
+ Expect(parse).Should(Exit(0))
session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=aa-test-profile", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
@@ -121,14 +122,14 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
skipIfAppArmorDisabled()
session := podmanTest.Podman([]string{"run", "--security-opt", "apparmor=invalid", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).ToNot(Equal(0))
+ Expect(session).To(ExitWithError())
})
It("podman run apparmor unconfined", func() {
skipIfAppArmorDisabled()
session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=unconfined", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
@@ -141,7 +142,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
// Should fail if user specifies apparmor on disabled system
session := podmanTest.Podman([]string{"create", "--security-opt", fmt.Sprintf("apparmor=%s", apparmor.Profile), ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).ToNot(Equal(0))
+ Expect(session).To(ExitWithError())
})
It("podman run apparmor disabled no default", func() {
@@ -149,7 +150,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
// Should succeed if user specifies apparmor on disabled system
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
@@ -162,7 +163,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=unconfined", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
// Verify that apparmor.Profile is being set