diff --git a/netlink/netlink_linux_test.go b/netlink/netlink_linux_test.go new file mode 100644 index 00000000..4f2aab08 --- /dev/null +++ b/netlink/netlink_linux_test.go @@ -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") + } +}