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:
@@ -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"))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user