1
0
mirror of https://github.com/moby/moby.git synced 2025-12-03 07:41:01 +03:00

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>
This commit is contained in:
Zhang Wei
2016-01-28 22:19:25 +08:00
parent 725b5b595b
commit 62a856e912
34 changed files with 298 additions and 591 deletions

View File

@@ -95,8 +95,7 @@ func (s *DockerSuite) TestEventsOOMDisableTrue(c *check.C) {
c.Assert(waitRun("oomTrue"), checker.IsNil)
defer dockerCmd(c, "kill", "oomTrue")
containerID, err := inspectField("oomTrue", "Id")
c.Assert(err, checker.IsNil)
containerID := inspectField(c, "oomTrue", "Id")
testActions := map[string]chan bool{
"oom": make(chan bool),
@@ -119,8 +118,7 @@ func (s *DockerSuite) TestEventsOOMDisableTrue(c *check.C) {
}
}
status, err := inspectField("oomTrue", "State.Status")
c.Assert(err, checker.IsNil)
status := inspectField(c, "oomTrue", "State.Status")
c.Assert(strings.TrimSpace(status), checker.Equals, "running", check.Commentf("container should be still running"))
}