浏览代码

Add the TestRunSwapLessThanMemoryLimit case.

Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
Yuan Sun 10 年之前
父节点
当前提交
ab39a4c981
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      integration-cli/docker_cli_run_unix_test.go

+ 12 - 0
integration-cli/docker_cli_run_unix_test.go

@@ -338,3 +338,15 @@ func (s *DockerSuite) TestStopContainerSignal(c *check.C) {
 		c.Fatalf("Expected `exit trapped` in the log, got %v", out)
 	}
 }
+
+func (s *DockerSuite) TestRunSwapLessThanMemoryLimit(c *check.C) {
+	testRequires(c, memoryLimitSupport)
+	testRequires(c, swapMemorySupport)
+	out, _, err := dockerCmdWithError("run", "-m", "16m", "--memory-swap", "15m", "busybox", "echo", "test")
+	expected := "Minimum memoryswap limit should be larger than memory limit"
+	c.Assert(err, check.NotNil)
+
+	if !strings.Contains(out, expected) {
+		c.Fatalf("Expected output to contain %q, not %q", out, expected)
+	}
+}