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

Merge pull request #41857 from gunadhya/Fix_Error_in_daemon_unix

Fix Error in daemon_unix.go and docker_cli_run_unit_test.go
This commit is contained in:
Brian Goff 2021-01-05 10:28:23 -08:00 committed by GitHub
commit 4f7faa29e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -461,7 +461,7 @@ func verifyPlatformContainerResources(resources *containertypes.Resources, sysIn
resources.MemoryReservation = 0 resources.MemoryReservation = 0
} }
if resources.MemoryReservation > 0 && resources.MemoryReservation < linuxMinMemory { if resources.MemoryReservation > 0 && resources.MemoryReservation < linuxMinMemory {
return warnings, fmt.Errorf("Minimum memory reservation allowed is 4MB") return warnings, fmt.Errorf("Minimum memory reservation allowed is 6MB")
} }
if resources.Memory > 0 && resources.MemoryReservation > 0 && resources.Memory < resources.MemoryReservation { if resources.Memory > 0 && resources.MemoryReservation > 0 && resources.Memory < resources.MemoryReservation {
return warnings, fmt.Errorf("Minimum memory limit can not be less than memory reservation limit, see usage") return warnings, fmt.Errorf("Minimum memory limit can not be less than memory reservation limit, see usage")

View file

@ -697,7 +697,7 @@ func (s *DockerSuite) TestRunWithMemoryReservationInvalid(c *testing.T) {
assert.Assert(c, strings.Contains(strings.TrimSpace(out), expected), "run container should fail with invalid memory reservation") assert.Assert(c, strings.Contains(strings.TrimSpace(out), expected), "run container should fail with invalid memory reservation")
out, _, err = dockerCmdWithError("run", "--memory-reservation", "1k", "busybox", "true") out, _, err = dockerCmdWithError("run", "--memory-reservation", "1k", "busybox", "true")
assert.ErrorContains(c, err, "") assert.ErrorContains(c, err, "")
expected = "Minimum memory reservation allowed is 4MB" expected = "Minimum memory reservation allowed is 6MB"
assert.Assert(c, strings.Contains(strings.TrimSpace(out), expected), "run container should fail with invalid memory reservation") assert.Assert(c, strings.Contains(strings.TrimSpace(out), expected), "run container should fail with invalid memory reservation")
} }