Merge pull request #18697 from jfrazelle/pids-cgroup
Add PIDs cgroup support to Docker Upstream-commit: dd32445ecc6b706e8681dcc9d80c42c9b6cbf6cd Component: engine
This commit is contained in:
@@ -968,3 +968,15 @@ func (s *DockerSuite) TestRunDeviceSymlink(c *check.C) {
|
||||
c.Assert(err, check.NotNil)
|
||||
c.Assert(strings.Trim(out, "\r\n"), checker.Contains, "not a device node", check.Commentf("expected output 'not a device node'"))
|
||||
}
|
||||
|
||||
// TestRunPidsLimit makes sure the pids cgroup is set with --pids-limit
|
||||
func (s *DockerSuite) TestRunPidsLimit(c *check.C) {
|
||||
testRequires(c, pidsLimit)
|
||||
|
||||
file := "/sys/fs/cgroup/pids/pids.max"
|
||||
out, _ := dockerCmd(c, "run", "--name", "skittles", "--pids-limit", "2", "busybox", "cat", file)
|
||||
c.Assert(strings.TrimSpace(out), checker.Equals, "2")
|
||||
|
||||
out = inspectField(c, "skittles", "HostConfig.PidsLimit")
|
||||
c.Assert(out, checker.Equals, "2", check.Commentf("setting the pids limit failed"))
|
||||
}
|
||||
|
||||
@@ -33,6 +33,12 @@ var (
|
||||
},
|
||||
"Test requires Oom control enabled.",
|
||||
}
|
||||
pidsLimit = testRequirement{
|
||||
func() bool {
|
||||
return SysInfo.PidsLimit
|
||||
},
|
||||
"Test requires pids limit enabled.",
|
||||
}
|
||||
kernelMemorySupport = testRequirement{
|
||||
func() bool {
|
||||
return SysInfo.KernelMemory
|
||||
|
||||
Reference in New Issue
Block a user