1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #2561 from thaJeztah/update_errortesting

testing: remove use of docker/docker/errdefs in tests
This commit is contained in:
Sebastiaan van Stijn 2020-08-31 17:46:37 +02:00 committed by GitHub
commit b4ba050e83

View file

@ -10,7 +10,6 @@ import (
"sync"
"testing"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/pkg/plugins"
"github.com/docker/docker/pkg/reexec"
"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) {
cnt, err := controller.NewSandbox("null_container",
libnetwork.OptionHostname("test"),
@ -210,7 +214,7 @@ func TestUnknownDriver(t *testing.T) {
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)
}
}
@ -222,7 +226,7 @@ func TestNilRemoteDriver(t *testing.T) {
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)
}
}
@ -1405,7 +1409,7 @@ func TestValidRemoteDriver(t *testing.T) {
libnetwork.NetworkOptionGeneric(getEmptyGenericOption()))
if err != nil {
// Only fail if we could not find the plugin driver
if errdefs.IsNotFound(err) {
if isNotFound(err) {
t.Fatal(err)
}
return