aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-08-24 08:48:57 -0400
committerGitHub <noreply@github.com>2022-08-24 08:48:57 -0400
commite4cbbe786258c594c264013aa7b550489d5a9e77 (patch)
tree90dabb261908d80e2b51d537ac807117abfa1f5e /test
parent46430203da3b72982870aaceafdb208ca46123ee (diff)
parente1c206d982e8c2a9a63c7f18e3ba31e976e75602 (diff)
downloadpodman-e4cbbe786258c594c264013aa7b550489d5a9e77.tar.gz
podman-e4cbbe786258c594c264013aa7b550489d5a9e77.tar.bz2
podman-e4cbbe786258c594c264013aa7b550489d5a9e77.zip
Merge pull request #15447 from sstosh/e2e-memswap
e2e: Add run --memory-swap test
Diffstat (limited to 'test')
-rw-r--r--test/e2e/run_memory_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/e2e/run_memory_test.go b/test/e2e/run_memory_test.go
index 083020f08..3f611040b 100644
--- a/test/e2e/run_memory_test.go
+++ b/test/e2e/run_memory_test.go
@@ -66,6 +66,24 @@ var _ = Describe("Podman run memory", func() {
Expect(session.OutputToString()).To(Equal("41943040"))
})
+ It("podman run memory-swap test", func() {
+ var (
+ session *PodmanSessionIntegration
+ expect string
+ )
+
+ if CGROUPSV2 {
+ session = podmanTest.Podman([]string{"run", "--memory=20m", "--memory-swap=30M", "--net=none", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/memory.swap.max"})
+ expect = "10485760"
+ } else {
+ session = podmanTest.Podman([]string{"run", "--memory=20m", "--memory-swap=30M", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes"})
+ expect = "31457280"
+ }
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).To(Equal(expect))
+ })
+
for _, limit := range []string{"0", "15", "100"} {
limit := limit // Keep this value in a proper scope
testName := fmt.Sprintf("podman run memory-swappiness test(%s)", limit)