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

Update integration tests with --net flag

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby 2014-05-23 11:31:01 -07:00
parent 973fae9d75
commit 581e8e8918

View file

@ -251,13 +251,13 @@ func TestDockerRunWorkingDirectory(t *testing.T) {
// pinging Google's DNS resolver should fail when we disable the networking // pinging Google's DNS resolver should fail when we disable the networking
func TestDockerRunWithoutNetworking(t *testing.T) { func TestDockerRunWithoutNetworking(t *testing.T) {
runCmd := exec.Command(dockerBinary, "run", "--networking=false", "busybox", "ping", "-c", "1", "8.8.8.8") runCmd := exec.Command(dockerBinary, "run", "--net=none", "busybox", "ping", "-c", "1", "8.8.8.8")
out, _, exitCode, err := runCommandWithStdoutStderr(runCmd) out, _, exitCode, err := runCommandWithStdoutStderr(runCmd)
if err != nil && exitCode != 1 { if err != nil && exitCode != 1 {
t.Fatal(out, err) t.Fatal(out, err)
} }
if exitCode != 1 { if exitCode != 1 {
t.Errorf("--networking=false should've disabled the network; the container shouldn't have been able to ping 8.8.8.8") t.Errorf("--net=none should've disabled the network; the container shouldn't have been able to ping 8.8.8.8")
} }
runCmd = exec.Command(dockerBinary, "run", "-n=false", "busybox", "ping", "-c", "1", "8.8.8.8") runCmd = exec.Command(dockerBinary, "run", "-n=false", "busybox", "ping", "-c", "1", "8.8.8.8")
@ -271,7 +271,7 @@ func TestDockerRunWithoutNetworking(t *testing.T) {
deleteAllContainers() deleteAllContainers()
logDone("run - disable networking with --networking=false") logDone("run - disable networking with --net=none")
logDone("run - disable networking with -n=false") logDone("run - disable networking with -n=false")
} }
@ -678,7 +678,7 @@ func TestContainerNetwork(t *testing.T) {
// Issue #4681 // Issue #4681
func TestLoopbackWhenNetworkDisabled(t *testing.T) { func TestLoopbackWhenNetworkDisabled(t *testing.T) {
cmd := exec.Command(dockerBinary, "run", "--networking=false", "busybox", "ping", "-c", "1", "127.0.0.1") cmd := exec.Command(dockerBinary, "run", "--net=none", "busybox", "ping", "-c", "1", "127.0.0.1")
if _, err := runCommand(cmd); err != nil { if _, err := runCommand(cmd); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -689,7 +689,7 @@ func TestLoopbackWhenNetworkDisabled(t *testing.T) {
} }
func TestLoopbackOnlyExistsWhenNetworkingDisabled(t *testing.T) { func TestLoopbackOnlyExistsWhenNetworkingDisabled(t *testing.T) {
cmd := exec.Command(dockerBinary, "run", "--networking=false", "busybox", "ip", "a", "show", "up") cmd := exec.Command(dockerBinary, "run", "--net=none", "busybox", "ip", "a", "show", "up")
out, _, err := runCommandWithOutput(cmd) out, _, err := runCommandWithOutput(cmd)
if err != nil { if err != nil {
t.Fatal(err, out) t.Fatal(err, out)