Merge pull request #36261 from yongtang/02082018-oom-killed

Migrate docker_cli_oom_killed_test.go to api tests
Upstream-commit: 1bb389121d985affeb2a572bc48d3f2cd38582ed
Component: engine
This commit is contained in:
Yong Tang
2018-02-12 09:50:26 -08:00
committed by GitHub
2 changed files with 37 additions and 30 deletions
@@ -1,30 +0,0 @@
// +build !windows
package main
import (
"github.com/docker/docker/integration-cli/checker"
"github.com/go-check/check"
)
func (s *DockerSuite) TestInspectOomKilledTrue(c *check.C) {
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")
c.Assert(exitCode, checker.Equals, 137, check.Commentf("OOM exit should be 137"))
oomKilled := inspectField(c, name, "State.OOMKilled")
c.Assert(oomKilled, checker.Equals, "true")
}
func (s *DockerSuite) TestInspectOomKilledFalse(c *check.C) {
testRequires(c, DaemonIsLinux, memoryLimitSupport, swapMemorySupport)
name := "testoomkilled"
dockerCmd(c, "run", "--name", name, "--memory", "32MB", "busybox", "sh", "-c", "echo hello world")
oomKilled := inspectField(c, name, "State.OOMKilled")
c.Assert(oomKilled, checker.Equals, "false")
}