mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
686be57d0a
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
42 lines
692 B
Go
42 lines
692 B
Go
//go:build linux
|
|
// +build linux
|
|
|
|
package bridge
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/docker/docker/libnetwork/types"
|
|
)
|
|
|
|
func getPorts() []types.TransportPort {
|
|
return []types.TransportPort{
|
|
{Proto: types.TCP, Port: uint16(5000)},
|
|
{Proto: types.UDP, Port: uint16(400)},
|
|
{Proto: types.TCP, Port: uint16(600)},
|
|
}
|
|
}
|
|
|
|
func TestLinkNew(t *testing.T) {
|
|
ports := getPorts()
|
|
|
|
link := newLink("172.0.17.3", "172.0.17.2", ports, "docker0")
|
|
|
|
if link == nil {
|
|
t.FailNow()
|
|
}
|
|
if link.parentIP != "172.0.17.3" {
|
|
t.Fail()
|
|
}
|
|
if link.childIP != "172.0.17.2" {
|
|
t.Fail()
|
|
}
|
|
for i, p := range link.ports {
|
|
if p != ports[i] {
|
|
t.Fail()
|
|
}
|
|
}
|
|
if link.bridge != "docker0" {
|
|
t.Fail()
|
|
}
|
|
}
|