mirror of
https://github.com/clearlinux/libnetwork.git
synced 2026-08-21 13:35:56 +00:00
@@ -7,6 +7,7 @@ import (
|
|||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/libnetwork"
|
"github.com/docker/libnetwork"
|
||||||
_ "github.com/docker/libnetwork/drivers/bridge"
|
_ "github.com/docker/libnetwork/drivers/bridge"
|
||||||
|
"github.com/docker/libnetwork/netutils"
|
||||||
"github.com/docker/libnetwork/pkg/options"
|
"github.com/docker/libnetwork/pkg/options"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ func createTestNetwork(networkType, networkName string, option options.Generic)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSimplebridge(t *testing.T) {
|
func TestSimplebridge(t *testing.T) {
|
||||||
|
defer netutils.SetupTestNetNS(t)()
|
||||||
ip, subnet, err := net.ParseCIDR("192.168.100.1/24")
|
ip, subnet, err := net.ParseCIDR("192.168.100.1/24")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -80,6 +82,7 @@ func TestSimplebridge(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUnknownDriver(t *testing.T) {
|
func TestUnknownDriver(t *testing.T) {
|
||||||
|
defer netutils.SetupTestNetNS(t)()
|
||||||
_, err := createTestNetwork("unknowndriver", "testnetwork", options.Generic{})
|
_, err := createTestNetwork("unknowndriver", "testnetwork", options.Generic{})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("Expected to fail. But instead succeeded")
|
t.Fatal("Expected to fail. But instead succeeded")
|
||||||
@@ -119,6 +122,7 @@ func TestNoInitDriver(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDuplicateNetwork(t *testing.T) {
|
func TestDuplicateNetwork(t *testing.T) {
|
||||||
|
defer netutils.SetupTestNetNS(t)()
|
||||||
controller := libnetwork.New()
|
controller := libnetwork.New()
|
||||||
|
|
||||||
option := options.Generic{}
|
option := options.Generic{}
|
||||||
@@ -182,6 +186,7 @@ func TestNetworkID(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDeleteNetworkWithActiveEndpoints(t *testing.T) {
|
func TestDeleteNetworkWithActiveEndpoints(t *testing.T) {
|
||||||
|
defer netutils.SetupTestNetNS(t)()
|
||||||
option := options.Generic{
|
option := options.Generic{
|
||||||
"BridgeName": bridgeName,
|
"BridgeName": bridgeName,
|
||||||
"AllowNonDefaultBridge": true}
|
"AllowNonDefaultBridge": true}
|
||||||
@@ -216,6 +221,7 @@ func TestDeleteNetworkWithActiveEndpoints(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUnknownNetwork(t *testing.T) {
|
func TestUnknownNetwork(t *testing.T) {
|
||||||
|
defer netutils.SetupTestNetNS(t)()
|
||||||
option := options.Generic{
|
option := options.Generic{
|
||||||
"BridgeName": bridgeName,
|
"BridgeName": bridgeName,
|
||||||
"AllowNonDefaultBridge": true}
|
"AllowNonDefaultBridge": true}
|
||||||
@@ -241,6 +247,7 @@ func TestUnknownNetwork(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUnknownEndpoint(t *testing.T) {
|
func TestUnknownEndpoint(t *testing.T) {
|
||||||
|
defer netutils.SetupTestNetNS(t)()
|
||||||
ip, subnet, err := net.ParseCIDR("192.168.100.1/24")
|
ip, subnet, err := net.ParseCIDR("192.168.100.1/24")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user