diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-04-24 17:30:47 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-04-27 11:59:22 +0200 |
commit | df9450925b2335790108860e7dba389e24fa5f7d (patch) | |
tree | 882622f7005269ed47199df85f983d5f908142a0 /test/e2e/pause_test.go | |
parent | e750c13b70fed44d7e6426732692f6802d638ef8 (diff) | |
download | podman-df9450925b2335790108860e7dba389e24fa5f7d.tar.gz podman-df9450925b2335790108860e7dba389e24fa5f7d.tar.bz2 podman-df9450925b2335790108860e7dba389e24fa5f7d.zip |
test: fix check for pause on cgroup v2
There is no freezer controller in the cgroup root, use the current
cgroup to look it up.
The test was never running on cgroup v2.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'test/e2e/pause_test.go')
-rw-r--r-- | test/e2e/pause_test.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/e2e/pause_test.go b/test/e2e/pause_test.go index 6ef27fa05..149a2e28a 100644 --- a/test/e2e/pause_test.go +++ b/test/e2e/pause_test.go @@ -2,7 +2,9 @@ package integration import ( "fmt" + "io/ioutil" "os" + "path/filepath" "strings" "github.com/containers/libpod/pkg/cgroups" @@ -32,7 +34,13 @@ var _ = Describe("Podman pause", func() { Expect(err).To(BeNil()) if cgroupsv2 { - _, err := os.Stat("/sys/fs/cgroup/cgroup.freeze") + b, err := ioutil.ReadFile("/proc/self/cgroup") + if err != nil { + Skip("cannot read self cgroup") + } + + path := filepath.Join("/sys/fs/cgroup", strings.TrimSuffix(strings.Replace(string(b), "0::", "", 1), "\n"), "cgroup.freeze") + _, err = os.Stat(path) if err != nil { Skip("freezer controller not available on the current kernel") } |