瀏覽代碼

Test for host networking

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Alexandr Morozov 10 年之前
父節點
當前提交
732c94a502
共有 1 個文件被更改,包括 18 次插入0 次删除
  1. 18 0
      integration-cli/docker_cli_run_test.go

+ 18 - 0
integration-cli/docker_cli_run_test.go

@@ -2705,3 +2705,21 @@ func TestRunNonLocalMacAddress(t *testing.T) {
 
 	logDone("run - use non-local mac-address")
 }
+
+func TestRunNetHost(t *testing.T) {
+	defer deleteAllContainers()
+	iplinkHost, err := exec.Command("ip", "link", "list").CombinedOutput()
+	if err != nil {
+		t.Fatal(err)
+	}
+
+	iplinkCont, err := exec.Command(dockerBinary, "run", "--net=host", "busybox", "ip", "link", "list").CombinedOutput()
+	if err != nil {
+		t.Fatal(err)
+	}
+
+	if !bytes.Equal(iplinkHost, iplinkCont) {
+		t.Fatalf("Container network:\n%s\nis not equal to host network:\n%s", iplinkCont, iplinkHost)
+	}
+	logDone("run - host network")
+}