1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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>
This commit is contained in:
Vitaly Ostrosablin 2017-03-23 14:31:28 +03:00
parent 58ccdfe00c
commit d4e132f84d

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