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

Integration test: bridge ip is excluded from the allocator pool

Signed-off-by: Federico Gimenez <fgimenez@coit.es>
This commit is contained in:
Federico Gimenez 2015-10-25 09:36:18 +01:00
parent c10ef20ed8
commit e8da75d4a1

View file

@ -1804,3 +1804,30 @@ func (s *DockerDaemonSuite) TestDaemonStartWithDefalutTlsHost(c *check.C) {
c.Fatalf("docker version should return information of server side")
}
}
func (s *DockerDaemonSuite) TestBridgeIPIsExcludedFromAllocatorPool(c *check.C) {
defaultNetworkBridge := "docker0"
deleteInterface(c, defaultNetworkBridge)
bridgeIP := "192.169.1.1"
bridgeRange := bridgeIP + "/30"
err := s.d.StartWithBusybox("--bip", bridgeRange)
c.Assert(err, check.IsNil)
defer s.d.Restart()
var cont int
for {
contName := fmt.Sprintf("container%d", cont)
_, err = s.d.Cmd("run", "--name", contName, "-d", "busybox", "/bin/sleep", "2")
if err != nil {
// pool exhausted
break
}
ip, err := s.d.Cmd("inspect", "--format", "'{{.NetworkSettings.IPAddress}}'", contName)
c.Assert(err, check.IsNil)
c.Assert(ip, check.Not(check.Equals), bridgeIP)
cont++
}
}