mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix update memory without memoryswap
The memory should always be smaller than memoryswap, we should error out with message that user know how to do rather than just an invalid argument error if user update the memory limit bigger than already set memory swap. Signed-off-by: Lei Jitang <leijitang@huawei.com>
This commit is contained in:
parent
9513aa3a48
commit
92394785fa
3 changed files with 25 additions and 0 deletions
|
@ -236,3 +236,17 @@ func (s *DockerSuite) TestUpdateStats(c *check.C) {
|
|||
c.Assert(preMemLimit, checker.Equals, curMemLimit)
|
||||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUpdateMemoryWithSwapMemory(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, memoryLimitSupport)
|
||||
testRequires(c, swapMemorySupport)
|
||||
|
||||
name := "test-update-container"
|
||||
dockerCmd(c, "run", "-d", "--name", name, "--memory", "300M", "busybox", "top")
|
||||
out, _, err := dockerCmdWithError("update", "--memory", "800M", name)
|
||||
c.Assert(err, checker.NotNil)
|
||||
c.Assert(out, checker.Contains, "Memory limit should be smaller than already set memoryswap limit")
|
||||
|
||||
dockerCmd(c, "update", "--memory", "800M", "--memory-swap", "1000M", name)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue