diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-11-03 11:44:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-03 11:44:23 +0100 |
commit | aae3e71f9a6e32307956c3c890455cb11af2ccbf (patch) | |
tree | 9cf284a5b81013c5580014c68bae302cb8f5df25 /test/e2e | |
parent | 8dfbdb561be5e2313dfa9f665e1f184089c8e967 (diff) | |
parent | afa4ec0db01b620be540e72e25fc86092e2fa303 (diff) | |
download | podman-aae3e71f9a6e32307956c3c890455cb11af2ccbf.tar.gz podman-aae3e71f9a6e32307956c3c890455cb11af2ccbf.tar.bz2 podman-aae3e71f9a6e32307956c3c890455cb11af2ccbf.zip |
Merge pull request #8217 from giuseppe/caps-ambient
specgen: add support for ambient capabilities
Diffstat (limited to 'test/e2e')
-rw-r--r-- | test/e2e/run_test.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index e6bba9f67..deb4419af 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -315,6 +315,39 @@ var _ = Describe("Podman run", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) Expect(session.OutputToString()).To(ContainSubstring("00000000a80425fb")) + + session = podmanTest.Podman([]string{"run", "--user=1000:1000", "--cap-add=DAC_OVERRIDE", "--rm", ALPINE, "grep", "CapAmb", "/proc/self/status"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(ContainSubstring("0000000000000002")) + + session = podmanTest.Podman([]string{"run", "--user=1000:1000", "--rm", ALPINE, "grep", "CapAmb", "/proc/self/status"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(ContainSubstring("0000000000000000")) + + session = podmanTest.Podman([]string{"run", "--user=0", "--cap-add=DAC_OVERRIDE", "--rm", ALPINE, "grep", "CapAmb", "/proc/self/status"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(ContainSubstring("0000000000000000")) + + session = podmanTest.Podman([]string{"run", "--user=0:0", "--cap-add=DAC_OVERRIDE", "--rm", ALPINE, "grep", "CapAmb", "/proc/self/status"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(ContainSubstring("0000000000000000")) + + if os.Geteuid() > 0 { + if os.Getenv("SKIP_USERNS") != "" { + Skip("Skip userns tests.") + } + if _, err := os.Stat("/proc/self/uid_map"); err != nil { + Skip("User namespaces not supported.") + } + session = podmanTest.Podman([]string{"run", "--userns=keep-id", "--cap-add=DAC_OVERRIDE", "--rm", ALPINE, "grep", "CapAmb", "/proc/self/status"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(ContainSubstring("0000000000000002")) + } }) It("podman run user capabilities test with image", func() { |