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:
@@ -42,7 +42,7 @@ func (s *DockerCLIBuildSuite) TestBuildResourceConstraintsAreUsed(c *testing.T)
|
|||||||
"--cpuset-mems=0",
|
"--cpuset-mems=0",
|
||||||
"--cpu-shares=100",
|
"--cpu-shares=100",
|
||||||
"--cpu-quota=8000",
|
"--cpu-quota=8000",
|
||||||
"--ulimit", "nofile=42",
|
"--ulimit", "nofile=50",
|
||||||
"--label="+buildLabel,
|
"--label="+buildLabel,
|
||||||
"-t", name, "."),
|
"-t", name, "."),
|
||||||
cli.InDir(ctx.Dir),
|
cli.InDir(ctx.Dir),
|
||||||
@@ -74,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.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.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].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
|
// Make sure constraints aren't saved to image
|
||||||
cli.DockerCmd(c, "run", "--name=test", name)
|
cli.DockerCmd(c, "run", "--name=test", name)
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ func deleteInterface(t *testing.T, ifName string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerDaemonSuite) TestDaemonUlimitDefaults(c *testing.T) {
|
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)")
|
out, err := s.d.Cmd("run", "--ulimit", "nproc=2048", "--name=test", "busybox", "/bin/sh", "-c", "echo $(ulimit -n); echo $(ulimit -u)")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -407,15 +407,15 @@ func (s *DockerDaemonSuite) TestDaemonUlimitDefaults(c *testing.T) {
|
|||||||
nofile := strings.TrimSpace(outArr[0])
|
nofile := strings.TrimSpace(outArr[0])
|
||||||
nproc := strings.TrimSpace(outArr[1])
|
nproc := strings.TrimSpace(outArr[1])
|
||||||
|
|
||||||
if nofile != "42" {
|
if nofile != "50" {
|
||||||
c.Fatalf("expected `ulimit -n` to be `42`, got: %s", nofile)
|
c.Fatalf("expected `ulimit -n` to be `50`, got: %s", nofile)
|
||||||
}
|
}
|
||||||
if nproc != "2048" {
|
if nproc != "2048" {
|
||||||
c.Fatalf("expected `ulimit -u` to be 2048, got: %s", nproc)
|
c.Fatalf("expected `ulimit -u` to be 2048, got: %s", nproc)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now restart daemon with a new default
|
// 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")
|
out, err = s.d.Cmd("start", "-a", "test")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -429,8 +429,8 @@ func (s *DockerDaemonSuite) TestDaemonUlimitDefaults(c *testing.T) {
|
|||||||
nofile = strings.TrimSpace(outArr[0])
|
nofile = strings.TrimSpace(outArr[0])
|
||||||
nproc = strings.TrimSpace(outArr[1])
|
nproc = strings.TrimSpace(outArr[1])
|
||||||
|
|
||||||
if nofile != "43" {
|
if nofile != "50" {
|
||||||
c.Fatalf("expected `ulimit -n` to be `43`, got: %s", nofile)
|
c.Fatalf("expected `ulimit -n` to be `50`, got: %s", nofile)
|
||||||
}
|
}
|
||||||
if nproc != "2048" {
|
if nproc != "2048" {
|
||||||
c.Fatalf("expected `ulimit -u` to be 2048, got: %s", nproc)
|
c.Fatalf("expected `ulimit -u` to be 2048, got: %s", nproc)
|
||||||
|
|||||||
@@ -3114,10 +3114,10 @@ func (s *DockerCLIRunSuite) TestRunWithUlimits(c *testing.T) {
|
|||||||
// Not applicable on Windows as uses Unix specific functionality
|
// Not applicable on Windows as uses Unix specific functionality
|
||||||
testRequires(c, DaemonIsLinux)
|
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)
|
ul := strings.TrimSpace(out)
|
||||||
if ul != "42" {
|
if ul != "50" {
|
||||||
c.Fatalf("expected `ulimit -n` to be 42, got %s", ul)
|
c.Fatalf("expected `ulimit -n` to be 50, got %s", ul)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3939,13 +3939,13 @@ func (s *DockerDaemonSuite) TestRunWithUlimitAndDaemonDefault(c *testing.T) {
|
|||||||
assert.NilError(c, err)
|
assert.NilError(c, err)
|
||||||
assert.Assert(c, is.Contains(out, "[nofile=65535:65535]"))
|
assert.Assert(c, is.Contains(out, "[nofile=65535:65535]"))
|
||||||
name = "test-B"
|
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, err)
|
||||||
assert.NilError(c, d.WaitRun(name))
|
assert.NilError(c, d.WaitRun(name))
|
||||||
|
|
||||||
out, err = d.Cmd("inspect", "--format", "{{.HostConfig.Ulimits}}", name)
|
out, err = d.Cmd("inspect", "--format", "{{.HostConfig.Ulimits}}", name)
|
||||||
assert.NilError(c, err)
|
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) {
|
func (s *DockerCLIRunSuite) TestRunStoppedLoggingDriverNoLeak(c *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user