Browse code

Fix TestInspectInt64 for run scenarios that return warnings

Instead of returning only the container ID, starting a container may
also return a warning:

"WARNING: Your kernel does not support swap
limit capabilities, memory limited without
swap.\nff6ebd9f7a8d035d17bb9a61eb9d3f0a5d563160cc43471a9d7ac9f71945d061"

The test assumes that only the container ID is returned and uses the
entire message as the name for the inspect command. To avoid the need to
parse the container ID from the output after the run command, give the
container a name and use that instead.

Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>

Christy Perez authored on 2015/10/14 00:42:25
Showing 1 changed files
... ...
@@ -27,13 +27,9 @@ func (s *DockerSuite) TestInspectImage(c *check.C) {
27 27
 
28 28
 func (s *DockerSuite) TestInspectInt64(c *check.C) {
29 29
 	testRequires(c, DaemonIsLinux)
30
-	out, _, err := dockerCmdWithError("run", "-d", "-m=300M", "busybox", "true")
31
-	if err != nil {
32
-		c.Fatalf("failed to run container: %v, output: %q", err, out)
33
-	}
34
-	out = strings.TrimSpace(out)
35 30
 
36
-	inspectOut, err := inspectField(out, "HostConfig.Memory")
31
+	dockerCmd(c, "run", "-d", "-m=300M", "--name", "inspectTest", "busybox", "true")
32
+	inspectOut, err := inspectField("inspectTest", "HostConfig.Memory")
37 33
 	c.Assert(err, check.IsNil)
38 34
 
39 35
 	if inspectOut != "314572800" {