Change TestExecUlimits to use nofile instead of nproc

Test used to check whether ulimits applied by docker are in effect by
setting up nproc. However, in some environments (e.g. inside Virtuozzo
Containers), number of processes is higher and testcase fails. Hence, we
instead change testcase to check ulimits by setting nofile limit instead
of nproc.

Signed-off-by: Vitaly Ostrosablin <vostrosablin@virtuozzo.com>
Upstream-commit: d4e132f84da72b5c2f2f63c95a8ca5cddabf8433
Component: engine
This commit is contained in:
Vitaly Ostrosablin
2017-03-23 14:31:28 +03:00
parent 4b6db08e9a
commit 291e5291fe

View File

@ -490,12 +490,12 @@ func (s *DockerSuite) TestExecOnReadonlyContainer(c *check.C) {
func (s *DockerSuite) TestExecUlimits(c *check.C) {
testRequires(c, DaemonIsLinux)
name := "testexeculimits"
runSleepingContainer(c, "-d", "--ulimit", "nproc=21", "--name", name)
runSleepingContainer(c, "-d", "--ulimit", "nofile=511:511", "--name", name)
c.Assert(waitRun(name), checker.IsNil)
out, _, err := dockerCmdWithError("exec", name, "sh", "-c", "ulimit -p")
out, _, err := dockerCmdWithError("exec", name, "sh", "-c", "ulimit -n")
c.Assert(err, checker.IsNil)
c.Assert(strings.TrimSpace(out), checker.Equals, "21")
c.Assert(strings.TrimSpace(out), checker.Equals, "511")
}
// #15750