mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
904a313396
This commits brings in a functionality for remote drivers to register with LibNetwork. The Built-In remote driver is responsible for the actual "remote" plugin to be made available. Having such a mechanism makes libnetwork core not dependent on any external plugin mechanism and also the Libnetwork NB apis are free of Driver interface. Signed-off-by: Madhu Venugopal <madhu@docker.com>
23 lines
561 B
Go
23 lines
561 B
Go
package libnetwork
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/docker/libnetwork/driverapi"
|
|
)
|
|
|
|
func TestDriverRegistration(t *testing.T) {
|
|
bridgeNetType := "bridge"
|
|
c := New()
|
|
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)
|
|
}
|
|
}
|