mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
integration-cli: Adjust nofile limits
runc v1.3.3 needs more file descriptors now. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
@@ -33,7 +33,18 @@ func (s *DockerCLIBuildSuite) TestBuildResourceConstraintsAreUsed(c *testing.T)
|
||||
RUN ["/hello"]
|
||||
`))
|
||||
cli.Docker(
|
||||
cli.Args("build", "--no-cache", "--rm=false", "--memory=64m", "--memory-swap=-1", "--cpuset-cpus=0", "--cpuset-mems=0", "--cpu-shares=100", "--cpu-quota=8000", "--ulimit", "nofile=42", "--label="+buildLabel, "-t", name, "."),
|
||||
cli.Args("build",
|
||||
"--no-cache",
|
||||
"--rm=false",
|
||||
"--memory=64m",
|
||||
"--memory-swap=-1",
|
||||
"--cpuset-cpus=0",
|
||||
"--cpuset-mems=0",
|
||||
"--cpu-shares=100",
|
||||
"--cpu-quota=8000",
|
||||
"--ulimit", "nofile=50",
|
||||
"--label="+buildLabel,
|
||||
"-t", name, "."),
|
||||
cli.InDir(ctx.Dir),
|
||||
).Assert(c, icmd.Success)
|
||||
|
||||
@@ -63,7 +74,7 @@ func (s *DockerCLIBuildSuite) TestBuildResourceConstraintsAreUsed(c *testing.T)
|
||||
assert.Equal(c, c1.CPUShares, int64(100), "resource constraints not set properly for CPUShares")
|
||||
assert.Equal(c, c1.CPUQuota, int64(8000), "resource constraints not set properly for CPUQuota")
|
||||
assert.Equal(c, c1.Ulimits[0].Name, "nofile", "resource constraints not set properly for Ulimits")
|
||||
assert.Equal(c, c1.Ulimits[0].Hard, int64(42), "resource constraints not set properly for Ulimits")
|
||||
assert.Equal(c, c1.Ulimits[0].Hard, int64(50), "resource constraints not set properly for Ulimits")
|
||||
|
||||
// Make sure constraints aren't saved to image
|
||||
cli.DockerCmd(c, "run", "--name=test", name)
|
||||
|
||||
@@ -391,7 +391,7 @@ func deleteInterface(t *testing.T, ifName string) {
|
||||
}
|
||||
|
||||
func (s *DockerDaemonSuite) TestDaemonUlimitDefaults(c *testing.T) {
|
||||
s.d.StartWithBusybox(testutil.GetContext(c), c, "--default-ulimit", "nofile=42:42", "--default-ulimit", "nproc=1024:1024")
|
||||
s.d.StartWithBusybox(testutil.GetContext(c), c, "--default-ulimit", "nofile=50:50", "--default-ulimit", "nproc=1024:1024")
|
||||
|
||||
out, err := s.d.Cmd("run", "--ulimit", "nproc=2048", "--name=test", "busybox", "/bin/sh", "-c", "echo $(ulimit -n); echo $(ulimit -u)")
|
||||
if err != nil {
|
||||
@@ -405,15 +405,15 @@ func (s *DockerDaemonSuite) TestDaemonUlimitDefaults(c *testing.T) {
|
||||
nofile := strings.TrimSpace(outArr[0])
|
||||
nproc := strings.TrimSpace(outArr[1])
|
||||
|
||||
if nofile != "42" {
|
||||
c.Fatalf("expected `ulimit -n` to be `42`, got: %s", nofile)
|
||||
if nofile != "50" {
|
||||
c.Fatalf("expected `ulimit -n` to be `50`, got: %s", nofile)
|
||||
}
|
||||
if nproc != "2048" {
|
||||
c.Fatalf("expected `ulimit -u` to be 2048, got: %s", nproc)
|
||||
}
|
||||
|
||||
// Now restart daemon with a new default
|
||||
s.d.Restart(c, "--default-ulimit", "nofile=43")
|
||||
s.d.Restart(c, "--default-ulimit", "nofile=50")
|
||||
|
||||
out, err = s.d.Cmd("start", "-a", "test")
|
||||
if err != nil {
|
||||
@@ -427,8 +427,8 @@ func (s *DockerDaemonSuite) TestDaemonUlimitDefaults(c *testing.T) {
|
||||
nofile = strings.TrimSpace(outArr[0])
|
||||
nproc = strings.TrimSpace(outArr[1])
|
||||
|
||||
if nofile != "43" {
|
||||
c.Fatalf("expected `ulimit -n` to be `43`, got: %s", nofile)
|
||||
if nofile != "50" {
|
||||
c.Fatalf("expected `ulimit -n` to be `50`, got: %s", nofile)
|
||||
}
|
||||
if nproc != "2048" {
|
||||
c.Fatalf("expected `ulimit -u` to be 2048, got: %s", nproc)
|
||||
|
||||
@@ -3099,10 +3099,10 @@ func (s *DockerCLIRunSuite) TestRunWithUlimits(c *testing.T) {
|
||||
// Not applicable on Windows as uses Unix specific functionality
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
out := cli.DockerCmd(c, "run", "--name=testulimits", "--ulimit", "nofile=42", "busybox", "/bin/sh", "-c", "ulimit -n").Combined()
|
||||
out := cli.DockerCmd(c, "run", "--name=testulimits", "--ulimit", "nofile=50", "busybox", "/bin/sh", "-c", "ulimit -n").Combined()
|
||||
ul := strings.TrimSpace(out)
|
||||
if ul != "42" {
|
||||
c.Fatalf("expected `ulimit -n` to be 42, got %s", ul)
|
||||
if ul != "50" {
|
||||
c.Fatalf("expected `ulimit -n` to be 50, got %s", ul)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3924,13 +3924,13 @@ func (s *DockerDaemonSuite) TestRunWithUlimitAndDaemonDefault(c *testing.T) {
|
||||
assert.NilError(c, err)
|
||||
assert.Assert(c, is.Contains(out, "[nofile=65535:65535]"))
|
||||
name = "test-B"
|
||||
_, err = d.Cmd("run", "--name", name, "--ulimit=nofile=42", "-d", "busybox", "top")
|
||||
_, err = d.Cmd("run", "--name", name, "--ulimit=nofile=50", "-d", "busybox", "top")
|
||||
assert.NilError(c, err)
|
||||
assert.NilError(c, d.WaitRun(name))
|
||||
|
||||
out, err = d.Cmd("inspect", "--format", "{{.HostConfig.Ulimits}}", name)
|
||||
assert.NilError(c, err)
|
||||
assert.Assert(c, is.Contains(out, "[nofile=42:42]"))
|
||||
assert.Assert(c, is.Contains(out, "[nofile=50:50]"))
|
||||
}
|
||||
|
||||
func (s *DockerCLIRunSuite) TestRunStoppedLoggingDriverNoLeak(c *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user