diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2021-07-28 16:52:22 +0200 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2021-08-10 20:32:13 -0400 |
commit | 870576b39e90cdbc029b116f9f6edecf09f56605 (patch) | |
tree | 4af3da956409f77dca5c9c29ed53dd1a2f1d7420 /test | |
parent | cb7f0a3025437b6d00c4e4eca903f0452ba3d711 (diff) | |
download | podman-870576b39e90cdbc029b116f9f6edecf09f56605.tar.gz podman-870576b39e90cdbc029b116f9f6edecf09f56605.tar.bz2 podman-870576b39e90cdbc029b116f9f6edecf09f56605.zip |
test: move container process to a sub-cgroup
move the container to a sub-cgroup before creating a sibling
hierarchy.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/run_cgroup_parent_test.go | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/test/e2e/run_cgroup_parent_test.go b/test/e2e/run_cgroup_parent_test.go index 300c3a8e0..3e261961b 100644 --- a/test/e2e/run_cgroup_parent_test.go +++ b/test/e2e/run_cgroup_parent_test.go @@ -2,6 +2,7 @@ package integration import ( "fmt" + "io/ioutil" "os" "path/filepath" "strings" @@ -80,7 +81,21 @@ var _ = Describe("Podman run with --cgroup-parent", func() { exec.WaitWithDefaultTimeout() Expect(exec).Should(Exit(0)) - cgroup := filepath.Dir(strings.TrimRight(strings.Replace(exec.OutputToString(), "0::", "", -1), "\n")) + containerCgroup := strings.TrimRight(strings.Replace(exec.OutputToString(), "0::", "", -1), "\n") + + content, err := ioutil.ReadFile(filepath.Join("/sys/fs/cgroup", containerCgroup, "cgroup.procs")) + Expect(err).To(BeNil()) + + // Move the container process to a sub cgroup + subCgroupPath := filepath.Join(filepath.Join("/sys/fs/cgroup", containerCgroup, "old-container")) + + err = os.MkdirAll(subCgroupPath, 0755) + Expect(err).To(BeNil()) + + err = ioutil.WriteFile(filepath.Join(subCgroupPath, "cgroup.procs"), content, 0644) + Expect(err).To(BeNil()) + + cgroup := filepath.Dir(containerCgroup) run = podmanTest.Podman([]string{"--cgroup-manager=cgroupfs", "run", "-d", fmt.Sprintf("--cgroup-parent=%s", cgroup), fedoraMinimal, "sleep", "100"}) run.WaitWithDefaultTimeout() |