1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Return error code when volume inspect fails with a template.

Following `docker inspect` conventions:

- Keep partial info in a buffer to not print incomplete template outputs.
- Break execution when template parsing or decoding fail.

Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
David Calavera 2015-12-02 15:24:30 -05:00
parent aa2ca5d93c
commit b9d30280f6
2 changed files with 32 additions and 22 deletions

View file

@ -165,3 +165,13 @@ func (s *DockerSuite) TestVolumeCliNoArgs(c *check.C) {
c.Assert(stderr, checker.Contains, usage)
c.Assert(stderr, checker.Contains, "flag provided but not defined: --no-such-flag")
}
func (s *DockerSuite) TestVolumeCliInspectTmplError(c *check.C) {
out, _ := dockerCmd(c, "volume", "create")
name := strings.TrimSpace(out)
out, exitCode, err := dockerCmdWithError("volume", "inspect", "--format='{{ .FooBar }}'", name)
c.Assert(err, checker.NotNil, check.Commentf("Output: %s", out))
c.Assert(exitCode, checker.Equals, 1, check.Commentf("Output: %s", out))
c.Assert(out, checker.Contains, "Template parsing error")
}