func createGlobalInstance(t *testing.T) { var err error defer close(start) origns, err = netns.Get() if err != nil { t.Fatal(err) } if netutils.IsRunningInContainer() { testns = origns } else { testns, err = netns.New() if err != nil { t.Fatal(err) } } netOption := options.Generic{ netlabel.GenericData: options.Generic{ "BridgeName": "network", "AllowNonDefaultBridge": true, }, } net, err := createTestNetwork(bridgeNetType, "network", netOption) if err != nil { t.Fatal("new network") } _, err = net.CreateEndpoint("ep1") if err != nil { t.Fatal("createendpoint") } }
func createGlobalInstance(t *testing.T) { var err error defer close(start) origns, err = netns.Get() if err != nil { t.Fatal(err) } if netutils.IsRunningInContainer() { testns = origns } else { testns, err = netns.New() if err != nil { t.Fatal(err) } } ctrlr, err = libnetwork.New() if err != nil { t.Fatal(err) } err = ctrlr.ConfigureNetworkDriver(bridgeNetType, getEmptyGenericOption()) if err != nil { t.Fatal("configure driver") } net, err := ctrlr.NewNetwork(bridgeNetType, "network1") if err != nil { t.Fatal("new network") } _, err = net.CreateEndpoint("ep1") if err != nil { t.Fatal("createendpoint") } }