Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
| ... | ... |
@@ -12,6 +12,7 @@ import ( |
| 12 | 12 |
"strings" |
| 13 | 13 |
"time" |
| 14 | 14 |
|
| 15 |
+ "github.com/docker/docker/pkg/integration/checker" |
|
| 15 | 16 |
"github.com/docker/docker/pkg/mount" |
| 16 | 17 |
"github.com/go-check/check" |
| 17 | 18 |
"github.com/kr/pty" |
| ... | ... |
@@ -205,13 +206,16 @@ func (s *DockerSuite) TestRunWithCpuPeriod(c *check.C) {
|
| 205 | 205 |
func (s *DockerSuite) TestRunWithKernelMemory(c *check.C) {
|
| 206 | 206 |
testRequires(c, kernelMemorySupport) |
| 207 | 207 |
|
| 208 |
- dockerCmd(c, "run", "--kernel-memory", "50M", "--name", "test", "busybox", "true") |
|
| 208 |
+ dockerCmd(c, "run", "--kernel-memory", "50M", "--name", "test1", "busybox", "true") |
|
| 209 | 209 |
|
| 210 |
- out, err := inspectField("test", "HostConfig.KernelMemory")
|
|
| 210 |
+ out, err := inspectField("test1", "HostConfig.KernelMemory")
|
|
| 211 | 211 |
c.Assert(err, check.IsNil) |
| 212 |
- if out != "52428800" {
|
|
| 213 |
- c.Fatalf("setting the kernel memory limit failed")
|
|
| 214 |
- } |
|
| 212 |
+ c.Assert(out, check.Equals, "52428800") |
|
| 213 |
+ |
|
| 214 |
+ out, _, err = dockerCmdWithError("run", "--kernel-memory", "-16m", "--name", "test2", "busybox", "echo", "test")
|
|
| 215 |
+ expected := "invalid size" |
|
| 216 |
+ c.Assert(err, check.NotNil) |
|
| 217 |
+ c.Assert(out, checker.Contains, expected) |
|
| 215 | 218 |
} |
| 216 | 219 |
|
| 217 | 220 |
// "test" should be printed |