summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2021-09-14 12:16:13 +0200
committerMatthew Heon <mheon@redhat.com>2021-09-16 11:00:05 -0400
commit5532cd488b0dd174ebf5675991b4fe8fb1ff9edd (patch)
treecaa19e54d9515d922d1f8c3dc73ad27d67366c1b /test/e2e
parente07dccc3ad33c9018466b40056de5f002cd11271 (diff)
downloadpodman-5532cd488b0dd174ebf5675991b4fe8fb1ff9edd.tar.gz
podman-5532cd488b0dd174ebf5675991b4fe8fb1ff9edd.tar.bz2
podman-5532cd488b0dd174ebf5675991b4fe8fb1ff9edd.zip
libpod: honor --cgroups=split also with pods
Honor --cgroups=split also when the container is running in a pod. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/run_test.go53
1 files changed, 32 insertions, 21 deletions
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index cb61aba21..ec4b0d997 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -1296,31 +1296,42 @@ USER mail`, BB)
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).Should(Exit(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.
- // crun does not set named hierarchies.
- if parts[1] == "" || strings.Contains(parts[1], "name=") {
+ checkLines := func(lines []string) {
+ cgroup := ""
+ for _, line := range lines {
+ parts := strings.SplitN(line, ":", 3)
+ if len(parts) < 2 {
continue
}
+ if !CGROUPSV2 {
+ // ignore unified on cgroup v1.
+ // both runc and crun do not set it.
+ // crun does not set named hierarchies.
+ if parts[1] == "" || strings.Contains(parts[1], "name=") {
+ continue
+ }
+ }
+ if parts[2] == "/" {
+ continue
+ }
+ if cgroup == "" {
+ cgroup = parts[2]
+ continue
+ }
+ Expect(cgroup).To(Equal(parts[2]))
}
- if parts[2] == "/" {
- continue
- }
- if cgroup == "" {
- cgroup = parts[2]
- continue
- }
- Expect(cgroup).To(Equal(parts[2]))
}
+
+ container := podmanTest.Podman([]string{"run", "--rm", "--cgroups=split", ALPINE, "cat", "/proc/self/cgroup"})
+ container.WaitWithDefaultTimeout()
+ Expect(container).Should(Exit(0))
+ checkLines(container.OutputToStringArray())
+
+ // check that --cgroups=split is honored also when a container runs in a pod
+ container = podmanTest.Podman([]string{"run", "--rm", "--pod", "new:split-test-pod", "--cgroups=split", ALPINE, "cat", "/proc/self/cgroup"})
+ container.WaitWithDefaultTimeout()
+ Expect(container).Should(Exit(0))
+ checkLines(container.OutputToStringArray())
})
It("podman run with cgroups=disabled runs without cgroups", func() {