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:
parent
aa2ca5d93c
commit
b9d30280f6
2 changed files with 32 additions and 22 deletions
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue