Implement all inspect commands with the new inspector interface.

It makes the behavior completely consistent across commands.
It adds tests to check that execution stops when an element is not
found.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 57b6796304880331d0d4e9cbefab7b139e718915
Component: engine
This commit is contained in:
David Calavera
2015-12-07 22:04:38 -05:00
parent 1c8ead7dbd
commit cb6bc1b323
10 changed files with 190 additions and 225 deletions

View File

@ -53,15 +53,17 @@ func (s *DockerSuite) TestVolumeCliInspect(c *check.C) {
func (s *DockerSuite) TestVolumeCliInspectMulti(c *check.C) {
dockerCmd(c, "volume", "create", "--name", "test1")
dockerCmd(c, "volume", "create", "--name", "test2")
dockerCmd(c, "volume", "create", "--name", "not-shown")
out, _, err := dockerCmdWithError("volume", "inspect", "--format='{{ .Name }}'", "test1", "test2", "doesntexist")
out, _, err := dockerCmdWithError("volume", "inspect", "--format='{{ .Name }}'", "test1", "test2", "doesntexist", "not-shown")
c.Assert(err, checker.NotNil)
outArr := strings.Split(strings.TrimSpace(out), "\n")
c.Assert(len(outArr), check.Equals, 3, check.Commentf("\n%s", out))
c.Assert(strings.Contains(out, "test1\n"), check.Equals, true)
c.Assert(strings.Contains(out, "test2\n"), check.Equals, true)
c.Assert(strings.Contains(out, "Error: No such volume: doesntexist\n"), check.Equals, true)
c.Assert(out, checker.Contains, "test1")
c.Assert(out, checker.Contains, "test2")
c.Assert(out, checker.Contains, "Error: No such volume: doesntexist")
c.Assert(out, checker.Not(checker.Contains), "not-shown")
}
func (s *DockerSuite) TestVolumeCliLs(c *check.C) {