diff options
author | openshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com> | 2021-08-03 18:36:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-03 18:36:00 +0000 |
commit | 7d53d88e8c2bca462673966cc9b565feeecf99f4 (patch) | |
tree | 5463706d53d8a01c2f75c0ad3ff6f5b7155438c7 /test | |
parent | e93661f5e765d84893e2ad5a488682c0a67412d0 (diff) | |
parent | 8ccf2539edc5ed65ec8b2a4353e2a21176884287 (diff) | |
download | podman-7d53d88e8c2bca462673966cc9b565feeecf99f4.tar.gz podman-7d53d88e8c2bca462673966cc9b565feeecf99f4.tar.bz2 podman-7d53d88e8c2bca462673966cc9b565feeecf99f4.zip |
Merge pull request #11068 from giuseppe/drop-dir-cgroup-test
test: move container process to a sub-cgroup
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() |