mirror of
https://github.com/moby/moby.git
synced 2025-07-29 07:21:35 +03:00
Fix crash caused by docker service inspect --pretty
This fix tries to fix the crash caused by `docker service inspect --pretty`, by performing necessary nil pointer check. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
@ -1072,3 +1072,19 @@ func (s *DockerSwarmSuite) TestSwarmManagerAddress(c *check.C) {
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Contains, expectedOutput)
|
||||
}
|
||||
|
||||
func (s *DockerSwarmSuite) TestSwarmServiceInspectPretty(c *check.C) {
|
||||
d := s.AddDaemon(c, true, true)
|
||||
|
||||
name := "top"
|
||||
out, err := d.Cmd("service", "create", "--name", name, "--limit-cpu=0.5", "busybox", "top")
|
||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
||||
|
||||
expectedOutput := `
|
||||
Resources:
|
||||
Limits:
|
||||
CPU: 0.5`
|
||||
out, err = d.Cmd("service", "inspect", "--pretty", name)
|
||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
||||
c.Assert(out, checker.Contains, expectedOutput, check.Commentf(out))
|
||||
}
|
||||
|
Reference in New Issue
Block a user