Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
| ... | ... |
@@ -322,9 +322,13 @@ func (s *DockerSuite) TestRunWithSwappiness(c *check.C) {
|
| 322 | 322 |
func (s *DockerSuite) TestRunWithSwappinessInvalid(c *check.C) {
|
| 323 | 323 |
testRequires(c, memorySwappinessSupport) |
| 324 | 324 |
out, _, err := dockerCmdWithError("run", "--memory-swappiness", "101", "busybox", "true")
|
| 325 |
- if err == nil {
|
|
| 326 |
- c.Fatalf("failed. test was able to set invalid value, output: %q", out)
|
|
| 327 |
- } |
|
| 325 |
+ c.Assert(err, check.NotNil) |
|
| 326 |
+ expected := "Valid memory swappiness range is 0-100" |
|
| 327 |
+ c.Assert(out, checker.Contains, expected, check.Commentf("Expected output to contain %q, not %q", out, expected))
|
|
| 328 |
+ |
|
| 329 |
+ out, _, err = dockerCmdWithError("run", "--memory-swappiness", "-10", "busybox", "true")
|
|
| 330 |
+ c.Assert(err, check.NotNil) |
|
| 331 |
+ c.Assert(out, checker.Contains, expected, check.Commentf("Expected output to contain %q, not %q", out, expected))
|
|
| 328 | 332 |
} |
| 329 | 333 |
|
| 330 | 334 |
func (s *DockerSuite) TestRunWithMemoryReservation(c *check.C) {
|