diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2021-07-28 16:52:22 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2021-07-29 09:08:00 +0200 |
commit | 8ccf2539edc5ed65ec8b2a4353e2a21176884287 (patch) | |
tree | 93b9ecea783cc8afc8a2dccc5ff54983fe212750 /test/e2e/run_cgroup_parent_test.go | |
parent | f9395ddc5ad8b32e4e9b24542f0869722f7c9743 (diff) | |
download | podman-8ccf2539edc5ed65ec8b2a4353e2a21176884287.tar.gz podman-8ccf2539edc5ed65ec8b2a4353e2a21176884287.tar.bz2 podman-8ccf2539edc5ed65ec8b2a4353e2a21176884287.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/e2e/run_cgroup_parent_test.go')
-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() |