Browse code

Test for host networking

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>

Alexandr Morozov authored on 2014/12/25 13:40:41
Showing 1 changed files
... ...
@@ -2705,3 +2705,21 @@ func TestRunNonLocalMacAddress(t *testing.T) {
2705 2705
 
2706 2706
 	logDone("run - use non-local mac-address")
2707 2707
 }
2708
+
2709
+func TestRunNetHost(t *testing.T) {
2710
+	defer deleteAllContainers()
2711
+	iplinkHost, err := exec.Command("ip", "link", "list").CombinedOutput()
2712
+	if err != nil {
2713
+		t.Fatal(err)
2714
+	}
2715
+
2716
+	iplinkCont, err := exec.Command(dockerBinary, "run", "--net=host", "busybox", "ip", "link", "list").CombinedOutput()
2717
+	if err != nil {
2718
+		t.Fatal(err)
2719
+	}
2720
+
2721
+	if !bytes.Equal(iplinkHost, iplinkCont) {
2722
+		t.Fatalf("Container network:\n%s\nis not equal to host network:\n%s", iplinkCont, iplinkHost)
2723
+	}
2724
+	logDone("run - host network")
2725
+}