summaryrefslogtreecommitdiff
path: root/test/e2e/run_test.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-03-03 12:28:54 -0500
committerGitHub <noreply@github.com>2021-03-03 12:28:54 -0500
commit87e20560ac885c541784af1341098ce8e1e7a940 (patch)
tree036fb1fb20fd3cf4503a7ab478b4842acaf9cb5d /test/e2e/run_test.go
parent32b2e367b81ffc808195dbc5ee3097d9936bb57f (diff)
parent81a3f8a43235077fb93faefe6da34fa6af88a625 (diff)
downloadpodman-87e20560ac885c541784af1341098ce8e1e7a940.tar.gz
podman-87e20560ac885c541784af1341098ce8e1e7a940.tar.bz2
podman-87e20560ac885c541784af1341098ce8e1e7a940.zip
Merge pull request #9536 from jmguzik/enable-cgroupsv2-sec-opts
Enable cgroupsv2 rw mount via security-opt unmask
Diffstat (limited to 'test/e2e/run_test.go')
-rw-r--r--test/e2e/run_test.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index f0ba9d1d9..490d05699 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -304,6 +304,42 @@ var _ = Describe("Podman run", func() {
})
+ It("podman run security-opt unmask on /sys/fs/cgroup", func() {
+
+ SkipIfCgroupV1("podman umask on /sys/fs/cgroup will fail with cgroups V1")
+ SkipIfRootless("/sys/fs/cgroup rw access is needed")
+ rwOnCGroups := "/sys/fs/cgroup cgroup2 rw"
+ session := podmanTest.Podman([]string{"run", "--security-opt", "unmask=ALL", "--security-opt", "mask=/sys/fs/cgroup", ALPINE, "cat", "/proc/mounts"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(rwOnCGroups))
+
+ session = podmanTest.Podman([]string{"run", "--security-opt", "unmask=/sys/fs/cgroup", ALPINE, "cat", "/proc/mounts"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(rwOnCGroups))
+
+ session = podmanTest.Podman([]string{"run", "--security-opt", "unmask=/sys/fs/cgroup///", ALPINE, "cat", "/proc/mounts"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(rwOnCGroups))
+
+ session = podmanTest.Podman([]string{"run", "--security-opt", "unmask=ALL", ALPINE, "cat", "/proc/mounts"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(rwOnCGroups))
+
+ session = podmanTest.Podman([]string{"run", "--security-opt", "unmask=/sys/fs/cgroup", "--security-opt", "mask=/sys/fs/cgroup", ALPINE, "cat", "/proc/mounts"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(rwOnCGroups))
+
+ session = podmanTest.Podman([]string{"run", "--security-opt", "unmask=/sys/fs/cgroup", ALPINE, "ls", "/sys/fs/cgroup"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).ToNot(BeEmpty())
+ })
+
It("podman run seccomp test", func() {
session := podmanTest.Podman([]string{"run", "-it", "--security-opt", strings.Join([]string{"seccomp=", forbidGetCWDSeccompProfile()}, ""), ALPINE, "pwd"})
session.WaitWithDefaultTimeout()