1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/libnetwork/drivers/remote/driver_test.go
Madhu Venugopal 904a313396 Remote Driver Registration
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>
2015-05-06 21:45:30 -07:00

29 lines
631 B
Go

package remote
import (
"testing"
"github.com/docker/libnetwork/driverapi"
)
type testCallbackStruct struct {
networkType string
}
func (t *testCallbackStruct) RegisterDriver(networkType string, driver driverapi.Driver) error {
t.networkType = networkType
return nil
}
func TestCallback(t *testing.T) {
tc := &testCallbackStruct{}
_, d := New(tc)
expected := "test-dummy"
_, err := d.(*driver).registerRemoteDriver(expected)
if err != nil {
t.Fatalf("Remote Driver callback registration failed with Error : %v", err)
}
if tc.networkType != expected {
t.Fatal("Remote Driver Callback Registration failed")
}
}