|
@@ -10,7 +10,6 @@ import (
|
|
"sync"
|
|
"sync"
|
|
"testing"
|
|
"testing"
|
|
|
|
|
|
- "github.com/docker/docker/errdefs"
|
|
|
|
"github.com/docker/docker/pkg/plugins"
|
|
"github.com/docker/docker/pkg/plugins"
|
|
"github.com/docker/docker/pkg/reexec"
|
|
"github.com/docker/docker/pkg/reexec"
|
|
"github.com/docker/libnetwork"
|
|
"github.com/docker/libnetwork"
|
|
@@ -90,6 +89,11 @@ func getPortMapping() []types.PortBinding {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func isNotFound(err error) bool {
|
|
|
|
+ _, ok := (err).(types.NotFoundError)
|
|
|
|
+ return ok
|
|
|
|
+}
|
|
|
|
+
|
|
func TestNull(t *testing.T) {
|
|
func TestNull(t *testing.T) {
|
|
cnt, err := controller.NewSandbox("null_container",
|
|
cnt, err := controller.NewSandbox("null_container",
|
|
libnetwork.OptionHostname("test"),
|
|
libnetwork.OptionHostname("test"),
|
|
@@ -210,7 +214,7 @@ func TestUnknownDriver(t *testing.T) {
|
|
t.Fatal("Expected to fail. But instead succeeded")
|
|
t.Fatal("Expected to fail. But instead succeeded")
|
|
}
|
|
}
|
|
|
|
|
|
- if !errdefs.IsNotFound(err) {
|
|
|
|
|
|
+ if !isNotFound(err) {
|
|
t.Fatalf("Did not fail with expected error. Actual error: %v", err)
|
|
t.Fatalf("Did not fail with expected error. Actual error: %v", err)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -222,7 +226,7 @@ func TestNilRemoteDriver(t *testing.T) {
|
|
t.Fatal("Expected to fail. But instead succeeded")
|
|
t.Fatal("Expected to fail. But instead succeeded")
|
|
}
|
|
}
|
|
|
|
|
|
- if !errdefs.IsNotFound(err) {
|
|
|
|
|
|
+ if !isNotFound(err) {
|
|
t.Fatalf("Did not fail with expected error. Actual error: %v", err)
|
|
t.Fatalf("Did not fail with expected error. Actual error: %v", err)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1405,7 +1409,7 @@ func TestValidRemoteDriver(t *testing.T) {
|
|
libnetwork.NetworkOptionGeneric(getEmptyGenericOption()))
|
|
libnetwork.NetworkOptionGeneric(getEmptyGenericOption()))
|
|
if err != nil {
|
|
if err != nil {
|
|
// Only fail if we could not find the plugin driver
|
|
// Only fail if we could not find the plugin driver
|
|
- if errdefs.IsNotFound(err) {
|
|
|
|
|
|
+ if isNotFound(err) {
|
|
t.Fatal(err)
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
return
|
|
return
|