diff options
Diffstat (limited to 'test/e2e/run_security_labels_test.go')
-rw-r--r-- | test/e2e/run_security_labels_test.go | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/test/e2e/run_security_labels_test.go b/test/e2e/run_security_labels_test.go index ae86bb690..1da80e61d 100644 --- a/test/e2e/run_security_labels_test.go +++ b/test/e2e/run_security_labels_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 generate kube", func() { @@ -37,11 +38,11 @@ var _ = Describe("Podman generate kube", func() { It("podman security labels", func() { test1 := podmanTest.Podman([]string{"create", "--label", "io.containers.capabilities=setuid,setgid", "--name", "test1", "alpine", "echo", "test1"}) test1.WaitWithDefaultTimeout() - Expect(test1.ExitCode()).To(BeZero()) + Expect(test1).Should(Exit(0)) inspect := podmanTest.Podman([]string{"inspect", "test1"}) inspect.WaitWithDefaultTimeout() - Expect(inspect.ExitCode()).To(Equal(0)) + Expect(inspect).Should(Exit(0)) ctr := inspect.InspectContainerToJSON() caps := strings.Join(ctr[0].EffectiveCaps, ",") @@ -51,11 +52,11 @@ var _ = Describe("Podman generate kube", func() { It("podman bad security labels", func() { test1 := podmanTest.Podman([]string{"create", "--label", "io.containers.capabilities=sys_admin", "--name", "test1", "alpine", "echo", "test1"}) test1.WaitWithDefaultTimeout() - Expect(test1.ExitCode()).To(BeZero()) + Expect(test1).Should(Exit(0)) inspect := podmanTest.Podman([]string{"inspect", "test1"}) inspect.WaitWithDefaultTimeout() - Expect(inspect.ExitCode()).To(Equal(0)) + Expect(inspect).Should(Exit(0)) ctr := inspect.InspectContainerToJSON() caps := strings.Join(ctr[0].EffectiveCaps, ",") @@ -65,11 +66,11 @@ var _ = Describe("Podman generate kube", func() { It("podman --cap-add sys_admin security labels", func() { test1 := podmanTest.Podman([]string{"create", "--cap-add", "SYS_ADMIN", "--label", "io.containers.capabilities=sys_admin", "--name", "test1", "alpine", "echo", "test1"}) test1.WaitWithDefaultTimeout() - Expect(test1.ExitCode()).To(BeZero()) + Expect(test1).Should(Exit(0)) inspect := podmanTest.Podman([]string{"inspect", "test1"}) inspect.WaitWithDefaultTimeout() - Expect(inspect.ExitCode()).To(Equal(0)) + Expect(inspect).Should(Exit(0)) ctr := inspect.InspectContainerToJSON() caps := strings.Join(ctr[0].EffectiveCaps, ",") @@ -79,11 +80,11 @@ var _ = Describe("Podman generate kube", func() { It("podman --cap-drop all sys_admin security labels", func() { test1 := podmanTest.Podman([]string{"create", "--cap-drop", "all", "--label", "io.containers.capabilities=sys_admin", "--name", "test1", "alpine", "echo", "test1"}) test1.WaitWithDefaultTimeout() - Expect(test1.ExitCode()).To(BeZero()) + Expect(test1).Should(Exit(0)) inspect := podmanTest.Podman([]string{"inspect", "test1"}) inspect.WaitWithDefaultTimeout() - Expect(inspect.ExitCode()).To(Equal(0)) + Expect(inspect).Should(Exit(0)) ctr := inspect.InspectContainerToJSON() caps := strings.Join(ctr[0].EffectiveCaps, ",") @@ -93,19 +94,19 @@ var _ = Describe("Podman generate kube", func() { It("podman security labels from image", func() { test1 := podmanTest.Podman([]string{"create", "--name", "test1", "alpine", "echo", "test1"}) test1.WaitWithDefaultTimeout() - Expect(test1.ExitCode()).To(BeZero()) + Expect(test1).Should(Exit(0)) commit := podmanTest.Podman([]string{"commit", "-c", "label=io.containers.capabilities=sys_chroot,setuid", "test1", "image1"}) commit.WaitWithDefaultTimeout() - Expect(commit.ExitCode()).To(BeZero()) + Expect(commit).Should(Exit(0)) image1 := podmanTest.Podman([]string{"create", "--name", "test2", "image1", "echo", "test1"}) image1.WaitWithDefaultTimeout() - Expect(image1.ExitCode()).To(BeZero()) + Expect(image1).Should(Exit(0)) inspect := podmanTest.Podman([]string{"inspect", "test2"}) inspect.WaitWithDefaultTimeout() - Expect(inspect.ExitCode()).To(Equal(0)) + Expect(inspect).Should(Exit(0)) ctr := inspect.InspectContainerToJSON() caps := strings.Join(ctr[0].EffectiveCaps, ",") @@ -116,11 +117,11 @@ var _ = Describe("Podman generate kube", func() { It("podman --privileged security labels", func() { pull := podmanTest.Podman([]string{"create", "--privileged", "--label", "io.containers.capabilities=setuid,setgid", "--name", "test1", "alpine", "echo", "test"}) pull.WaitWithDefaultTimeout() - Expect(pull.ExitCode()).To(BeZero()) + Expect(pull).Should(Exit(0)) inspect := podmanTest.Podman([]string{"inspect", "test1"}) inspect.WaitWithDefaultTimeout() - Expect(inspect.ExitCode()).To(Equal(0)) + Expect(inspect).Should(Exit(0)) ctr := inspect.InspectContainerToJSON() caps := strings.Join(ctr[0].EffectiveCaps, ",") @@ -138,11 +139,11 @@ LABEL io.containers.capabilities=chown,kill`, ALPINE) test1 := podmanTest.Podman([]string{"create", "--name", "test1", image, "echo", "test1"}) test1.WaitWithDefaultTimeout() - Expect(test1.ExitCode()).To(BeZero()) + Expect(test1).Should(Exit(0)) inspect := podmanTest.Podman([]string{"inspect", "test1"}) inspect.WaitWithDefaultTimeout() - Expect(inspect.ExitCode()).To(Equal(0)) + Expect(inspect).Should(Exit(0)) ctr := inspect.InspectContainerToJSON() caps := strings.Join(ctr[0].EffectiveCaps, ",") |