Add the swapMemorySupport requirement to OOM tests

Add the swapMemorySupport requirement to all tests related to the OOM killer.  The --memory option has the subtle side effect of defaulting --memory-swap to double the value of --memory.  The OOM killer doesn't kick in until the container exhausts memory+swap, and so without the memory swap cgroup the tests will timeout due to swap being effectively unlimited.

Document the default behavior of --memory-swap in the docker run man page.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Upstream-commit: adabb51311ecac031bd72378c5ed1669d1835d40
Component: engine
This commit is contained in:
Sean Christopherson
2016-05-10 09:58:55 -07:00
parent 7f34b3bcd4
commit 3ff3d68824
3 changed files with 5 additions and 4 deletions

View File

@ -8,7 +8,7 @@ import (
)
func (s *DockerSuite) TestInspectOomKilledTrue(c *check.C) {
testRequires(c, DaemonIsLinux, memoryLimitSupport)
testRequires(c, DaemonIsLinux, memoryLimitSupport, swapMemorySupport)
name := "testoomkilled"
_, exitCode, _ := dockerCmdWithError("run", "--name", name, "--memory", "32MB", "busybox", "sh", "-c", "x=a; while true; do x=$x$x$x$x; done")
@ -20,7 +20,7 @@ func (s *DockerSuite) TestInspectOomKilledTrue(c *check.C) {
}
func (s *DockerSuite) TestInspectOomKilledFalse(c *check.C) {
testRequires(c, DaemonIsLinux, memoryLimitSupport)
testRequires(c, DaemonIsLinux, memoryLimitSupport, swapMemorySupport)
name := "testoomkilled"
dockerCmd(c, "run", "--name", name, "--memory", "32MB", "busybox", "sh", "-c", "echo hello world")