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>
| ... | ... |
@@ -490,12 +490,12 @@ func (s *DockerSuite) TestExecOnReadonlyContainer(c *check.C) {
|
| 490 | 490 |
func (s *DockerSuite) TestExecUlimits(c *check.C) {
|
| 491 | 491 |
testRequires(c, DaemonIsLinux) |
| 492 | 492 |
name := "testexeculimits" |
| 493 |
- runSleepingContainer(c, "-d", "--ulimit", "nproc=21", "--name", name) |
|
| 493 |
+ runSleepingContainer(c, "-d", "--ulimit", "nofile=511:511", "--name", name) |
|
| 494 | 494 |
c.Assert(waitRun(name), checker.IsNil) |
| 495 | 495 |
|
| 496 |
- out, _, err := dockerCmdWithError("exec", name, "sh", "-c", "ulimit -p")
|
|
| 496 |
+ out, _, err := dockerCmdWithError("exec", name, "sh", "-c", "ulimit -n")
|
|
| 497 | 497 |
c.Assert(err, checker.IsNil) |
| 498 |
- c.Assert(strings.TrimSpace(out), checker.Equals, "21") |
|
| 498 |
+ c.Assert(strings.TrimSpace(out), checker.Equals, "511") |
|
| 499 | 499 |
} |
| 500 | 500 |
|
| 501 | 501 |
// #15750 |