mirror of
https://github.com/moby/moby.git
synced 2025-07-30 18:23:29 +03:00
Add information for Manager Addresses
in the output of docker info
As is specified in 28018, it would be useful to know the manager's addresses even in a worker node. This is especially useful when there are many worker nodes in a big cluster. The information is available in `info.Swarm.RemoteManagers`. This fix add the information of `Manager Addresses` to the output of `docker info`, to explicitly show it. A test has been added for this fix. This fix fixes 28018. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
@ -1051,3 +1051,24 @@ func (s *DockerSwarmSuite) TestExtraHosts(c *check.C) {
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
||||
}
|
||||
|
||||
func (s *DockerSwarmSuite) TestSwarmManagerAddress(c *check.C) {
|
||||
d1 := s.AddDaemon(c, true, true)
|
||||
d2 := s.AddDaemon(c, true, false)
|
||||
d3 := s.AddDaemon(c, true, false)
|
||||
|
||||
// Manager Addresses will always show Node 1's address
|
||||
expectedOutput := fmt.Sprintf("Manager Addresses:\n 127.0.0.1:%d\n", d1.port)
|
||||
|
||||
out, err := d1.Cmd("info")
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Contains, expectedOutput)
|
||||
|
||||
out, err = d2.Cmd("info")
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Contains, expectedOutput)
|
||||
|
||||
out, err = d3.Cmd("info")
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Contains, expectedOutput)
|
||||
}
|
||||
|
Reference in New Issue
Block a user