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

Integration tests for --fixed-cidr daemon config

Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
Madhu Venugopal 2015-04-28 08:55:04 -07:00
parent 9c325c3f54
commit 0e254411b1

View file

@ -10,6 +10,7 @@ import (
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"strconv"
"strings" "strings"
"time" "time"
@ -486,6 +487,10 @@ func (s *DockerDaemonSuite) TestDaemonBridgeExternal(c *check.C) {
c.Assert(bridgeIPNet.Contains(ip), check.Equals, true, c.Assert(bridgeIPNet.Contains(ip), check.Equals, true,
check.Commentf("Container IP-Address must be in the same subnet range : %s", check.Commentf("Container IP-Address must be in the same subnet range : %s",
containerIp)) containerIp))
// Reset to Defaults
deleteBridge(c, bridgeName)
d.Restart()
} }
func deleteBridge(c *check.C, bridge string) { func deleteBridge(c *check.C, bridge string) {
@ -553,6 +558,37 @@ func (s *DockerDaemonSuite) TestDaemonBridgeIP(c *check.C) {
pingContainers(c) pingContainers(c)
} }
func (s *DockerDaemonSuite) TestDaemonBridgeFixedCidr(c *check.C) {
d := s.d
bridgeName := "external-bridge"
args := []string{"link", "add", "name", bridgeName, "type", "bridge"}
ipLinkCmd := exec.Command("ip", args...)
_, _, _, err := runCommandWithStdoutStderr(ipLinkCmd)
c.Assert(err, check.IsNil)
ifCmd := exec.Command("ifconfig", bridgeName, "192.169.1.1/24", "up")
_, _, _, err = runCommandWithStdoutStderr(ifCmd)
c.Assert(err, check.IsNil)
args = []string{"--bridge", bridgeName, "--fixed-cidr", "192.169.1.0/30"}
err = d.StartWithBusybox(args...)
c.Assert(err, check.IsNil)
for i := 0; i < 4; i++ {
cName := "Container" + strconv.Itoa(i)
out, err := d.Cmd("run", "-d", "--name", cName, "busybox", "top")
if err != nil {
c.Assert(strings.Contains(out, "no available ip addresses"), check.Equals, true,
check.Commentf("Could not run a Container : %s %s", err.Error(), out))
}
}
// Reset to Defaults
deleteBridge(c, bridgeName)
d.Restart()
}
func (s *DockerDaemonSuite) TestDaemonUlimitDefaults(c *check.C) { func (s *DockerDaemonSuite) TestDaemonUlimitDefaults(c *check.C) {
testRequires(c, NativeExecDriver) testRequires(c, NativeExecDriver)