mirror of
https://github.com/moby/moby.git
synced 2025-12-07 19:42:23 +03:00
Test for host networking
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user