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

integration-cli: error report improvements

1. After running d.Cmd(), in case an error is returned, it makes sense
to print command output, as its stderr may contain a clue about what
went wrong. This is by no means complete, just as far as I could go.

2. In case the comment in c.Assert is a constant string, it's better
to provide it as a comment which will be printed.

3. An arbitrary string should not be passed on to a function expecting
%-style formatting. Use %s to fix this.

4. Print the output string before transformation, not after.

5. Unify the output format (drop "out:" prefix").

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2018-08-14 10:51:22 +03:00
parent 83363fb2d4
commit ac038eab29
5 changed files with 170 additions and 173 deletions

View file

@ -287,16 +287,16 @@ func (s *DockerDaemonSuite) TestPluginListFilterEnabled(c *check.C) {
}()
out, err = s.d.Cmd("plugin", "ls", "--filter", "enabled=true")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(out, checker.Not(checker.Contains), pName)
out, err = s.d.Cmd("plugin", "ls", "--filter", "enabled=false")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(out, checker.Contains, pName)
c.Assert(out, checker.Contains, "false")
out, err = s.d.Cmd("plugin", "ls")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(out, checker.Contains, pName)
}
@ -315,14 +315,14 @@ func (s *DockerDaemonSuite) TestPluginListFilterCapability(c *check.C) {
}()
out, err = s.d.Cmd("plugin", "ls", "--filter", "capability=volumedriver")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(out, checker.Contains, pName)
out, err = s.d.Cmd("plugin", "ls", "--filter", "capability=authz")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(out, checker.Not(checker.Contains), pName)
out, err = s.d.Cmd("plugin", "ls")
c.Assert(err, checker.IsNil)
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(out, checker.Contains, pName)
}