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> Upstream-commit: b9d30280f6eb2f817b1315c22953a133f1b66e69 Component: engine
This commit is contained in:
@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user