summaryrefslogtreecommitdiff
path: root/test/e2e/run_memory_test.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-09-28 09:17:27 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-09-29 16:01:26 -0400
commitb496802413aecf95b0d2786cb6e13618b388a406 (patch)
tree1d48d952e8dff642ab5db1edbc9d30a4da4fbef5 /test/e2e/run_memory_test.go
parent453333a35cc791e9031e5d24e0ac5e76a2b2aa75 (diff)
downloadpodman-b496802413aecf95b0d2786cb6e13618b388a406.tar.gz
podman-b496802413aecf95b0d2786cb6e13618b388a406.tar.bz2
podman-b496802413aecf95b0d2786cb6e13618b388a406.zip
Make all Skips specify a reason
Always use CGROUPV2 rather then reading from system all the time. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test/e2e/run_memory_test.go')
-rw-r--r--test/e2e/run_memory_test.go39
1 files changed, 19 insertions, 20 deletions
diff --git a/test/e2e/run_memory_test.go b/test/e2e/run_memory_test.go
index a3dc9bae5..fa19b1824 100644
--- a/test/e2e/run_memory_test.go
+++ b/test/e2e/run_memory_test.go
@@ -3,7 +3,6 @@ package integration
import (
"os"
- "github.com/containers/podman/v2/pkg/cgroups"
. "github.com/containers/podman/v2/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -17,9 +16,9 @@ var _ = Describe("Podman run memory", func() {
)
BeforeEach(func() {
- SkipIfRootlessCgroupsV1()
+ SkipIfRootlessCgroupsV1("Setting Memory not supported on cgroupv1 for rootless users")
- SkipIfRootless()
+ SkipIfRootless("FIXME: This should work on cgroups V2 systems")
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
@@ -37,12 +36,9 @@ var _ = Describe("Podman run memory", func() {
})
It("podman run memory test", func() {
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
var session *PodmanSessionIntegration
- if cgroupsv2 {
+ if CGROUPSV2 {
session = podmanTest.Podman([]string{"run", "--memory=40m", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/memory.max"})
} else {
session = podmanTest.Podman([]string{"run", "--memory=40m", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.limit_in_bytes"})
@@ -57,28 +53,21 @@ var _ = Describe("Podman run memory", func() {
Skip("Unable to perform test on Ubuntu distributions due to memory management")
}
- cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
- Expect(err).To(BeNil())
-
var session *PodmanSessionIntegration
- if cgroupsv2 {
- session = podmanTest.Podman([]string{"run", "--memory-reservation=40m", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/memory.high"})
+ if CGROUPSV2 {
+ session = podmanTest.Podman([]string{"run", "--memory-reservation=40m", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/memory.low"})
} else {
session = podmanTest.Podman([]string{"run", "--memory-reservation=40m", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.soft_limit_in_bytes"})
}
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- if cgroupsv2 {
- Expect(session.OutputToString()).To(Equal("max"))
- } else {
- Expect(session.OutputToString()).To(Equal("41943040"))
- }
+ Expect(session.OutputToString()).To(Equal("41943040"))
})
It("podman run memory-swappiness test", func() {
- SkipIfCgroupV2()
+ SkipIfCgroupV2("memory-swappiness not supported on cgroupV2")
session := podmanTest.Podman([]string{"run", "--memory-swappiness=15", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.swappiness"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -86,8 +75,18 @@ var _ = Describe("Podman run memory", func() {
})
It("podman run kernel-memory test", func() {
- SkipIfCgroupV2()
- session := podmanTest.Podman([]string{"run", "--kernel-memory=40m", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.kmem.limit_in_bytes"})
+ if podmanTest.Host.Distribution == "ubuntu" {
+ Skip("Unable to perform test on Ubuntu distributions due to memory management")
+ }
+
+ var session *PodmanSessionIntegration
+
+ if CGROUPSV2 {
+ session = podmanTest.Podman([]string{"run", "--memory-reservation=40m", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/memory.low"})
+ } else {
+ session = podmanTest.Podman([]string{"run", "--memory-reservation=40m", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.soft_limit_in_bytes"})
+ }
+
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(Equal("41943040"))