mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
481568035f
Signed-off-by: Madhu Venugopal <madhu@docker.com>
32 lines
764 B
Go
32 lines
764 B
Go
package libnetwork
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/docker/libnetwork/datastore"
|
|
"github.com/docker/libnetwork/driverapi"
|
|
)
|
|
|
|
func TestDriverRegistration(t *testing.T) {
|
|
bridgeNetType := "bridge"
|
|
c, err := New("")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
err = c.(*controller).RegisterDriver(bridgeNetType, nil)
|
|
if err == nil {
|
|
t.Fatalf("Expecting the RegisterDriver to fail for %s", bridgeNetType)
|
|
}
|
|
if _, ok := err.(driverapi.ErrActiveRegistration); !ok {
|
|
t.Fatalf("Failed for unexpected reason: %v", err)
|
|
}
|
|
err = c.(*controller).RegisterDriver("test-dummy", nil)
|
|
if err != nil {
|
|
t.Fatalf("Test failed with an error %v", err)
|
|
}
|
|
}
|
|
|
|
func SetTestDataStore(c NetworkController, custom datastore.DataStore) {
|
|
con := c.(*controller)
|
|
con.store = custom
|
|
}
|