1
0
mirror of https://github.com/moby/moby.git synced 2025-12-06 07:41:18 +03:00

Check minimum kernel memory limit to be 4M

Fixes: #18405

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
Qiang Huang
2015-12-09 14:26:41 +08:00
parent c8ed1492bf
commit 2347f98003
4 changed files with 19 additions and 4 deletions

View File

@@ -169,10 +169,19 @@ func (s *DockerSuite) TestRunWithKernelMemory(c *check.C) {
out, err := inspectField("test1", "HostConfig.KernelMemory")
c.Assert(err, check.IsNil)
c.Assert(out, check.Equals, "52428800")
}
func (s *DockerSuite) TestRunWithInvalidKernelMemory(c *check.C) {
testRequires(c, kernelMemorySupport)
out, _, err := dockerCmdWithError("run", "--kernel-memory", "2M", "busybox", "true")
c.Assert(err, check.NotNil)
expected := "Minimum kernel memory limit allowed is 4MB"
c.Assert(out, checker.Contains, expected)
out, _, err = dockerCmdWithError("run", "--kernel-memory", "-16m", "--name", "test2", "busybox", "echo", "test")
expected := "invalid size"
c.Assert(err, check.NotNil)
expected = "invalid size"
c.Assert(out, checker.Contains, expected)
}