mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
a0a473125b
After moving libnetwork to this repo, we need to update all the import paths for libnetwork to point to docker/docker/libnetwork instead of docker/libnetwork. This change implements that. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
65 lines
1.3 KiB
Go
65 lines
1.3 KiB
Go
package macvlan
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/docker/docker/pkg/plugingetter"
|
|
"github.com/docker/docker/libnetwork/driverapi"
|
|
_ "github.com/docker/docker/libnetwork/testutils"
|
|
)
|
|
|
|
const testNetworkType = "macvlan"
|
|
|
|
type driverTester struct {
|
|
t *testing.T
|
|
d *driver
|
|
}
|
|
|
|
func (dt *driverTester) GetPluginGetter() plugingetter.PluginGetter {
|
|
return nil
|
|
}
|
|
|
|
func (dt *driverTester) RegisterDriver(name string, drv driverapi.Driver,
|
|
cap driverapi.Capability) error {
|
|
if name != testNetworkType {
|
|
dt.t.Fatalf("Expected driver register name to be %q. Instead got %q",
|
|
testNetworkType, name)
|
|
}
|
|
|
|
if _, ok := drv.(*driver); !ok {
|
|
dt.t.Fatalf("Expected driver type to be %T. Instead got %T",
|
|
&driver{}, drv)
|
|
}
|
|
|
|
dt.d = drv.(*driver)
|
|
return nil
|
|
}
|
|
|
|
func TestMacvlanInit(t *testing.T) {
|
|
if err := Init(&driverTester{t: t}, nil); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestMacvlanNilConfig(t *testing.T) {
|
|
dt := &driverTester{t: t}
|
|
if err := Init(dt, nil); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if err := dt.d.initStore(nil); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestMacvlanType(t *testing.T) {
|
|
dt := &driverTester{t: t}
|
|
if err := Init(dt, nil); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if dt.d.Type() != testNetworkType {
|
|
t.Fatalf("Expected Type() to return %q. Instead got %q", testNetworkType,
|
|
dt.d.Type())
|
|
}
|
|
}
|