diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2020-09-25 14:14:27 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-09-27 07:55:16 -0400 |
commit | 007c0ecd50846900eaa7b8ea2fde08c83746abda (patch) | |
tree | 83dabc69d240b41a0fbecd6a3f80e723cd206240 /test/e2e/run_cpu_test.go | |
parent | 03d01abec6d028e9d5f60615b0451e42d0611d1d (diff) | |
download | podman-007c0ecd50846900eaa7b8ea2fde08c83746abda.tar.gz podman-007c0ecd50846900eaa7b8ea2fde08c83746abda.tar.bz2 podman-007c0ecd50846900eaa7b8ea2fde08c83746abda.zip |
Remove SkipIfRootless if possible, document other calls
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test/e2e/run_cpu_test.go')
-rw-r--r-- | test/e2e/run_cpu_test.go | 44 |
1 files changed, 8 insertions, 36 deletions
diff --git a/test/e2e/run_cpu_test.go b/test/e2e/run_cpu_test.go index 401447579..86cc9d1c5 100644 --- a/test/e2e/run_cpu_test.go +++ b/test/e2e/run_cpu_test.go @@ -18,6 +18,8 @@ var _ = Describe("Podman run cpu", func() { ) BeforeEach(func() { + SkipIfRootlessCgroupsV1() + tempdir, err = CreateTempDirInTempDir() if err != nil { os.Exit(1) @@ -45,13 +47,8 @@ var _ = Describe("Podman run cpu", func() { }) It("podman run cpu-period", func() { - SkipIfRootless() - - cgroupsv2, err := cgroups.IsCgroup2UnifiedMode() - Expect(err).To(BeNil()) - var result *PodmanSessionIntegration - if cgroupsv2 { + if CGROUPSV2 { result = podmanTest.Podman([]string{"run", "--rm", "--cpu-period=5000", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.max"}) } else { result = podmanTest.Podman([]string{"run", "--rm", "--cpu-period=5000", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_period_us"}) @@ -62,14 +59,9 @@ var _ = Describe("Podman run cpu", func() { }) It("podman run cpu-quota", func() { - SkipIfRootless() - - cgroupsv2, err := cgroups.IsCgroup2UnifiedMode() - Expect(err).To(BeNil()) - var result *PodmanSessionIntegration - if cgroupsv2 { + if CGROUPSV2 { result = podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.max"}) } else { result = podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"}) @@ -80,12 +72,7 @@ var _ = Describe("Podman run cpu", func() { }) It("podman run cpus", func() { - SkipIfRootless() - - cgroupsv2, err := cgroups.IsCgroup2UnifiedMode() - Expect(err).To(BeNil()) - - if cgroupsv2 { + if CGROUPSV2 { result := podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.max"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) @@ -104,12 +91,7 @@ var _ = Describe("Podman run cpu", func() { }) It("podman run cpu-shares", func() { - SkipIfRootless() - - cgroupsv2, err := cgroups.IsCgroup2UnifiedMode() - Expect(err).To(BeNil()) - - if cgroupsv2 { + if CGROUPSV2 { // [2-262144] is mapped to [1-10000] result := podmanTest.Podman([]string{"run", "--rm", "--cpu-shares=262144", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.weight"}) result.WaitWithDefaultTimeout() @@ -124,14 +106,9 @@ var _ = Describe("Podman run cpu", func() { }) It("podman run cpuset-cpus", func() { - SkipIfRootless() - - cgroupsv2, err := cgroups.IsCgroup2UnifiedMode() - Expect(err).To(BeNil()) - var result *PodmanSessionIntegration - if cgroupsv2 { + if CGROUPSV2 { result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-cpus=0", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpuset.cpus.effective"}) } else { result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-cpus=0", ALPINE, "cat", "/sys/fs/cgroup/cpuset/cpuset.cpus"}) @@ -142,14 +119,9 @@ var _ = Describe("Podman run cpu", func() { }) It("podman run cpuset-mems", func() { - SkipIfRootless() - - cgroupsv2, err := cgroups.IsCgroup2UnifiedMode() - Expect(err).To(BeNil()) - var result *PodmanSessionIntegration - if cgroupsv2 { + if CGROUPSV2 { result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-mems=0", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpuset.mems.effective"}) } else { result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-mems=0", ALPINE, "cat", "/sys/fs/cgroup/cpuset/cpuset.mems"}) |