|
@@ -14,11 +14,18 @@ import (
|
|
|
"github.com/vishvananda/netlink"
|
|
|
)
|
|
|
|
|
|
-func TestCreate(t *testing.T) {
|
|
|
+func TestCreateFullOptions(t *testing.T) {
|
|
|
defer netutils.SetupTestNetNS(t)()
|
|
|
_, d := New()
|
|
|
|
|
|
- config := &Configuration{BridgeName: DefaultBridgeName}
|
|
|
+ config := &Configuration{
|
|
|
+ BridgeName: DefaultBridgeName,
|
|
|
+ EnableIPv6: true,
|
|
|
+ FixedCIDR: bridgeNetworks[0],
|
|
|
+ EnableIPTables: true,
|
|
|
+ EnableIPForwarding: true,
|
|
|
+ }
|
|
|
+ _, config.FixedCIDRv6, _ = net.ParseCIDR("2001:db8::/48")
|
|
|
genericOption := make(map[string]interface{})
|
|
|
genericOption[options.GenericData] = config
|
|
|
|
|
@@ -26,16 +33,17 @@ func TestCreate(t *testing.T) {
|
|
|
t.Fatalf("Failed to setup driver config: %v", err)
|
|
|
}
|
|
|
|
|
|
- if err := d.CreateNetwork("dummy", nil); err != nil {
|
|
|
+ err := d.CreateNetwork("dummy", nil)
|
|
|
+ if err != nil {
|
|
|
t.Fatalf("Failed to create bridge: %v", err)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func TestCreateFail(t *testing.T) {
|
|
|
+func TestCreate(t *testing.T) {
|
|
|
defer netutils.SetupTestNetNS(t)()
|
|
|
_, d := New()
|
|
|
|
|
|
- config := &Configuration{BridgeName: "dummy0"}
|
|
|
+ config := &Configuration{BridgeName: DefaultBridgeName}
|
|
|
genericOption := make(map[string]interface{})
|
|
|
genericOption[options.GenericData] = config
|
|
|
|
|
@@ -43,23 +51,16 @@ func TestCreateFail(t *testing.T) {
|
|
|
t.Fatalf("Failed to setup driver config: %v", err)
|
|
|
}
|
|
|
|
|
|
- if err := d.CreateNetwork("dummy", nil); err == nil {
|
|
|
- t.Fatal("Bridge creation was expected to fail")
|
|
|
+ if err := d.CreateNetwork("dummy", nil); err != nil {
|
|
|
+ t.Fatalf("Failed to create bridge: %v", err)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func TestCreateFullOptions(t *testing.T) {
|
|
|
+func TestCreateFail(t *testing.T) {
|
|
|
defer netutils.SetupTestNetNS(t)()
|
|
|
_, d := New()
|
|
|
|
|
|
- config := &Configuration{
|
|
|
- BridgeName: DefaultBridgeName,
|
|
|
- EnableIPv6: true,
|
|
|
- FixedCIDR: bridgeNetworks[0],
|
|
|
- EnableIPTables: true,
|
|
|
- EnableIPForwarding: true,
|
|
|
- }
|
|
|
- _, config.FixedCIDRv6, _ = net.ParseCIDR("2001:db8::/48")
|
|
|
+ config := &Configuration{BridgeName: "dummy0"}
|
|
|
genericOption := make(map[string]interface{})
|
|
|
genericOption[options.GenericData] = config
|
|
|
|
|
@@ -67,9 +68,8 @@ func TestCreateFullOptions(t *testing.T) {
|
|
|
t.Fatalf("Failed to setup driver config: %v", err)
|
|
|
}
|
|
|
|
|
|
- err := d.CreateNetwork("dummy", nil)
|
|
|
- if err != nil {
|
|
|
- t.Fatalf("Failed to create bridge: %v", err)
|
|
|
+ if err := d.CreateNetwork("dummy", nil); err == nil {
|
|
|
+ t.Fatal("Bridge creation was expected to fail")
|
|
|
}
|
|
|
}
|
|
|
|