diff options
| author | Zhang Wei <zhangwei555@huawei.com> | 2016-01-28 22:19:25 +0800 |
|---|---|---|
| committer | Zhang Wei <zhangwei555@huawei.com> | 2016-01-29 23:39:07 +0800 |
| commit | 62a856e9129c9d5cf7db9ea6322c9073d68e3ea4 (patch) | |
| tree | 9a0c92b71028d0005f46a0aac76fe0b9fc0399ea /integration-cli/docker_cli_commit_test.go | |
| parent | 725b5b595b50bc73654817aac2b515bcb0c8b5b8 (diff) | |
| download | docker-62a856e9129c9d5cf7db9ea6322c9073d68e3ea4.tar.gz | |
Assert error in body of function `inspectField*`
1. Replace raw `docker inspect -f xxx` with `inspectField`, to make code
cleaner and more consistent
2. assert the error in function `inspectField*` so we don't need to
assert the return value of it every time, this will make inspect easier.
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Diffstat (limited to 'integration-cli/docker_cli_commit_test.go')
| -rw-r--r-- | integration-cli/docker_cli_commit_test.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/integration-cli/docker_cli_commit_test.go b/integration-cli/docker_cli_commit_test.go index 8f650eaf5f..9a4520bba4 100644 --- a/integration-cli/docker_cli_commit_test.go +++ b/integration-cli/docker_cli_commit_test.go @@ -49,8 +49,7 @@ func (s *DockerSuite) TestCommitPausedContainer(c *check.C) { out, _ = dockerCmd(c, "commit", cleanedContainerID) - out, err := inspectField(cleanedContainerID, "State.Paused") - c.Assert(err, checker.IsNil, check.Commentf("%s", out)) + out = inspectField(c, cleanedContainerID, "State.Paused") // commit should not unpause a paused container c.Assert(out, checker.Contains, "true") } @@ -139,8 +138,7 @@ func (s *DockerSuite) TestCommitChange(c *check.C) { } for conf, value := range expected { - res, err := inspectField(imageID, conf) - c.Assert(err, checker.IsNil, check.Commentf("%s('%s')", conf, res)) + res := inspectField(c, imageID, conf) if res != value { c.Errorf("%s('%s'), expected %s", conf, res, value) } @@ -165,12 +163,10 @@ func (s *DockerSuite) TestCommitMergeConfigRun(c *check.C) { Cmd []string } config1 := cfg{} - err := inspectFieldAndMarshall(id, "Config", &config1) - c.Assert(err, checker.IsNil) + inspectFieldAndMarshall(c, id, "Config", &config1) config2 := cfg{} - err = inspectFieldAndMarshall(name, "Config", &config2) - c.Assert(err, checker.IsNil) + inspectFieldAndMarshall(c, name, "Config", &config2) // Env has at least PATH loaded as well here, so let's just grab the FOO one var env1, env2 string |
