Add start of netlink unit tests
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
This commit is contained in:
parent
200f7191d7
commit
4404b1521c
|
@ -0,0 +1,28 @@
|
||||||
|
package netlink
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestCreateBridgeWithMac(t *testing.T) {
|
||||||
|
name := "testbridge"
|
||||||
|
|
||||||
|
if err := CreateBridge(name, true); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := net.InterfaceByName(name); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// cleanup and tests
|
||||||
|
|
||||||
|
if err := DeleteBridge(name); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := net.InterfaceByName(name); err == nil {
|
||||||
|
t.Fatal("expected error getting interface because bridge was deleted")
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue