From ab39a4c98110d9a16afd73ce2992ab3d4532201a Mon Sep 17 00:00:00 2001 From: Yuan Sun Date: Mon, 21 Sep 2015 22:12:19 +0800 Subject: [PATCH] Add the TestRunSwapLessThanMemoryLimit case. Signed-off-by: Yuan Sun --- integration-cli/docker_cli_run_unix_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/integration-cli/docker_cli_run_unix_test.go b/integration-cli/docker_cli_run_unix_test.go index 5ffb496da..65cff3bc7 100644 --- a/integration-cli/docker_cli_run_unix_test.go +++ b/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) + } +}