1
0
mirror of https://github.com/moby/moby.git synced 2025-07-29 07:21:35 +03:00

Set default MemorySwappiness when adapt

It makes the inspect result consistent between cli and REST api
when MemorySwappiness is not set.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
Qiang Huang
2015-12-02 10:53:52 +08:00
parent 1415f55cc0
commit 4089b4e440
5 changed files with 14 additions and 9 deletions

View File

@ -1434,7 +1434,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *check.
var containerJSON types.ContainerJSON
c.Assert(json.Unmarshal(body, &containerJSON), check.IsNil)
c.Assert(containerJSON.HostConfig.ShmSize, check.IsNil)
c.Assert(*containerJSON.HostConfig.ShmSize, check.Equals, runconfig.DefaultSHMSize)
out, _ := dockerCmd(c, "start", "-i", containerJSON.ID)
shmRegexp := regexp.MustCompile(`shm on /dev/shm type tmpfs(.*)size=65536k`)
@ -1522,5 +1522,5 @@ func (s *DockerSuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted(
var containerJSON types.ContainerJSON
c.Assert(json.Unmarshal(body, &containerJSON), check.IsNil)
c.Assert(containerJSON.HostConfig.MemorySwappiness, check.IsNil)
c.Assert(*containerJSON.HostConfig.MemorySwappiness, check.Equals, int64(-1))
}