libnetwork/remote: newDriver(): return concrete type
Interface matching will happen on the receiver side. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
b2bde4a7d8
commit
0d76fc431a
2 changed files with 6 additions and 6 deletions
|
@ -25,7 +25,7 @@ type maybeError interface {
|
||||||
GetError() string
|
GetError() string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDriver(name string, client *plugins.Client) driverapi.Driver {
|
func newDriver(name string, client *plugins.Client) *driver {
|
||||||
return &driver{networkType: name, endpoint: client}
|
return &driver{networkType: name, endpoint: client}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ func Register(r driverapi.Registerer, pg plugingetter.PluginGetter) error {
|
||||||
newPluginHandler := func(name string, client *plugins.Client) {
|
newPluginHandler := func(name string, client *plugins.Client) {
|
||||||
// negotiate driver capability with client
|
// negotiate driver capability with client
|
||||||
d := newDriver(name, client)
|
d := newDriver(name, client)
|
||||||
c, err := d.(*driver).getCapabilities()
|
c, err := d.getCapabilities()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.G(context.TODO()).Errorf("error getting capability for %s due to %v", name, err)
|
log.G(context.TODO()).Errorf("error getting capability for %s due to %v", name, err)
|
||||||
return
|
return
|
||||||
|
|
|
@ -239,7 +239,7 @@ func TestGetEmptyCapabilities(t *testing.T) {
|
||||||
t.Fatal("Driver type does not match that given")
|
t.Fatal("Driver type does not match that given")
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = d.(*driver).getCapabilities()
|
_, err = d.getCapabilities()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("There should be error reported when get empty capability")
|
t.Fatal("There should be error reported when get empty capability")
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ func TestGetExtraCapabilities(t *testing.T) {
|
||||||
t.Fatal("Driver type does not match that given")
|
t.Fatal("Driver type does not match that given")
|
||||||
}
|
}
|
||||||
|
|
||||||
c, err := d.(*driver).getCapabilities()
|
c, err := d.getCapabilities()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
} else if c.DataScope != datastore.LocalScope {
|
} else if c.DataScope != datastore.LocalScope {
|
||||||
|
@ -309,7 +309,7 @@ func TestGetInvalidCapabilities(t *testing.T) {
|
||||||
t.Fatal("Driver type does not match that given")
|
t.Fatal("Driver type does not match that given")
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = d.(*driver).getCapabilities()
|
_, err = d.getCapabilities()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("There should be error reported when get invalid capability")
|
t.Fatal("There should be error reported when get invalid capability")
|
||||||
}
|
}
|
||||||
|
@ -427,7 +427,7 @@ func TestRemoteDriver(t *testing.T) {
|
||||||
t.Fatal("Driver type does not match that given")
|
t.Fatal("Driver type does not match that given")
|
||||||
}
|
}
|
||||||
|
|
||||||
c, err := d.(*driver).getCapabilities()
|
c, err := d.getCapabilities()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
} else if c.DataScope != datastore.GlobalScope {
|
} else if c.DataScope != datastore.GlobalScope {
|
||||||
|
|
Loading…
Reference in a new issue