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>
Upstream-commit: 4089b4e4400d44f7c0a5b15065c70228f10ebf0c
Component: engine
This commit is contained in:
Qiang Huang
2015-12-02 10:53:52 +08:00
parent 3ffe69d3e4
commit b52058194c
5 changed files with 14 additions and 9 deletions
@@ -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))
}