fix the problem that memory-swap=-1 is not working for docker command

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: aee28e0e87385de153e60e21c314032892b350f2
Component: engine
This commit is contained in:
Qiang Huang
2015-02-09 10:36:49 +08:00
parent ffcc4076f8
commit bed01ba5bf
2 changed files with 21 additions and 4 deletions

View File

@ -60,6 +60,19 @@ func TestRunEchoStdoutWithMemoryLimit(t *testing.T) {
logDone("run - echo with memory limit")
}
// should run without memory swap
func TestRunWithoutMemoryswapLimit(t *testing.T) {
runCmd := exec.Command(dockerBinary, "run", "-m", "16m", "--memory-swap", "-1", "busybox", "true")
out, _, err := runCommandWithOutput(runCmd)
if err != nil {
t.Fatalf("failed to run container, output: %q", out)
}
deleteAllContainers()
logDone("run - without memory swap limit")
}
// "test" should be printed
func TestRunEchoStdoutWitCPULimit(t *testing.T) {
runCmd := exec.Command(dockerBinary, "run", "-c", "1000", "busybox", "echo", "test")