mirror of
https://github.com/moby/moby.git
synced 2025-07-30 18:23:29 +03:00
do not fail fast when executing inspect command
Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
@ -353,14 +353,22 @@ func (s *DockerSuite) TestInspectByPrefix(c *check.C) {
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectStopWhenNotFound(c *check.C) {
|
||||
runSleepingContainer(c, "--name=busybox", "-d")
|
||||
runSleepingContainer(c, "--name=not-shown", "-d")
|
||||
out, _, err := dockerCmdWithError("inspect", "--type=container", "--format='{{.Name}}'", "busybox", "missing", "not-shown")
|
||||
runSleepingContainer(c, "--name=busybox1", "-d")
|
||||
runSleepingContainer(c, "--name=busybox2", "-d")
|
||||
result := dockerCmdWithResult("inspect", "--type=container", "--format='{{.Name}}'", "busybox1", "busybox2", "missing")
|
||||
|
||||
c.Assert(err, checker.Not(check.IsNil))
|
||||
c.Assert(out, checker.Contains, "busybox")
|
||||
c.Assert(out, checker.Not(checker.Contains), "not-shown")
|
||||
c.Assert(out, checker.Contains, "Error: No such container: missing")
|
||||
c.Assert(result.Error, checker.Not(check.IsNil))
|
||||
c.Assert(result.Stdout(), checker.Contains, "busybox1")
|
||||
c.Assert(result.Stdout(), checker.Contains, "busybox2")
|
||||
c.Assert(result.Stderr(), checker.Contains, "Error: No such container: missing")
|
||||
|
||||
// test inspect would not fast fail
|
||||
result = dockerCmdWithResult("inspect", "--type=container", "--format='{{.Name}}'", "missing", "busybox1", "busybox2")
|
||||
|
||||
c.Assert(result.Error, checker.Not(check.IsNil))
|
||||
c.Assert(result.Stdout(), checker.Contains, "busybox1")
|
||||
c.Assert(result.Stdout(), checker.Contains, "busybox2")
|
||||
c.Assert(result.Stderr(), checker.Contains, "Error: No such container: missing")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectHistory(c *check.C) {
|
||||
|
Reference in New Issue
Block a user