Browse code

Handle error for dockerCmdInDir

Only two of these are not handled, the one in `TestBuildForceRm`
is intended to not be handled, while the other one in
`TestBuildResourceConstraintsAreUsed` causes problem.

In test case `TestBuildResourceConstraintsAreUsed`, somehow we
are not able to access network to get base image, but the error
message is:

```
Error: failed to inspect container : Unable to read inspect data: json: cannot unmarshal array into Go value of type types.ContainerJSON
```

Totally confusion.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>

Qiang Huang authored on 2015/12/30 16:21:34
Showing 1 changed files
... ...
@@ -21,7 +21,10 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) {
21 21
 	`, map[string]string{})
22 22
 	c.Assert(err, checker.IsNil)
23 23
 
24
-	dockerCmdInDir(c, ctx.Dir, "build", "--no-cache", "--rm=false", "--memory=64m", "--memory-swap=-1", "--cpuset-cpus=0", "--cpuset-mems=0", "--cpu-shares=100", "--cpu-quota=8000", "--ulimit", "nofile=42", "-t", name, ".")
24
+	_, _, err = dockerCmdInDir(c, ctx.Dir, "build", "--no-cache", "--rm=false", "--memory=64m", "--memory-swap=-1", "--cpuset-cpus=0", "--cpuset-mems=0", "--cpu-shares=100", "--cpu-quota=8000", "--ulimit", "nofile=42", "-t", name, ".")
25
+	if err != nil {
26
+		c.Fatal(err)
27
+	}
25 28
 
26 29
 	out, _ := dockerCmd(c, "ps", "-lq")
27 30
 	cID := strings.TrimSpace(out)