diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-02-11 17:46:37 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-11 17:46:37 -0500 |
commit | 1b284a298c0bde20561321f325d4a7ad00e7bd25 (patch) | |
tree | 426d8db849f1f1f93435b4fe969cc18a4a3c88a6 /test | |
parent | b38b1433b3ecd9a4f1aa3ce816a76886432d8ec0 (diff) | |
parent | 660a06f2f79fc1edf68e286ee452ceb9dcd5e03a (diff) | |
download | podman-1b284a298c0bde20561321f325d4a7ad00e7bd25.tar.gz podman-1b284a298c0bde20561321f325d4a7ad00e7bd25.tar.bz2 podman-1b284a298c0bde20561321f325d4a7ad00e7bd25.zip |
Merge pull request #9302 from giuseppe/cgroup-split-v1
utils: takes the longest path on cgroup v1
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/common_test.go | 7 | ||||
-rw-r--r-- | test/e2e/run_test.go | 31 |
2 files changed, 38 insertions, 0 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index 53810d882..d033cc646 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -619,6 +619,13 @@ func SkipIfNotRootless(reason string) { } } +func SkipIfNotSystemd(manager, reason string) { + checkReason(reason) + if manager != "systemd" { + ginkgo.Skip("[notSystemd]: " + reason) + } +} + func SkipIfNotFedora() { info := GetHostDistributionInfo() if info.Distribution != "fedora" { diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 934b78202..18db63c15 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -1191,6 +1191,37 @@ USER mail` Expect(found).To(BeTrue()) }) + It("podman run with cgroups=split", func() { + SkipIfNotSystemd(podmanTest.CgroupManager, "do not test --cgroups=split if not running on systemd") + SkipIfRootlessCgroupsV1("Disable cgroups not supported on cgroupv1 for rootless users") + SkipIfRemote("--cgroups=split cannot be used in remote mode") + + container := podmanTest.Podman([]string{"run", "--rm", "--cgroups=split", ALPINE, "cat", "/proc/self/cgroup"}) + container.WaitWithDefaultTimeout() + Expect(container.ExitCode()).To(Equal(0)) + lines := container.OutputToStringArray() + + cgroup := "" + for _, line := range lines { + parts := strings.SplitN(line, ":", 3) + if !CGROUPSV2 { + // ignore unified on cgroup v1 + // both runc and crun do not set it. + if parts[1] == "" { + continue + } + } + if parts[2] == "/" { + continue + } + if cgroup == "" { + cgroup = parts[2] + continue + } + Expect(cgroup).To(Equal(parts[2])) + } + }) + It("podman run with cgroups=disabled runs without cgroups", func() { SkipIfRootless("FIXME: I believe this should work but need to fix this test") SkipIfRootlessCgroupsV1("Disable cgroups not supported on cgroupv1 for rootless users") |