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:
Michael Crosby 2014-07-23 10:41:10 -07:00
parent 200f7191d7
commit 4404b1521c
1 changed files with 28 additions and 0 deletions

View File

@ -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")
}
}