Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
| ... | ... |
@@ -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 |
+} |