@@ -10,7 +10,6 @@ import (
1010 "sync"
1111 "testing"
1212
13- "github.com/docker/docker/errdefs"
1413 "github.com/docker/docker/pkg/plugins"
1514 "github.com/docker/docker/pkg/reexec"
1615 "github.com/docker/libnetwork"
@@ -90,6 +89,11 @@ func getPortMapping() []types.PortBinding {
9089 }
9190}
9291
92+ func isNotFound (err error ) bool {
93+ _ , ok := (err ).(types.NotFoundError )
94+ return ok
95+ }
96+
9397func TestNull (t * testing.T ) {
9498 cnt , err := controller .NewSandbox ("null_container" ,
9599 libnetwork .OptionHostname ("test" ),
@@ -210,7 +214,7 @@ func TestUnknownDriver(t *testing.T) {
210214 t .Fatal ("Expected to fail. But instead succeeded" )
211215 }
212216
213- if ! errdefs . IsNotFound (err ) {
217+ if ! isNotFound (err ) {
214218 t .Fatalf ("Did not fail with expected error. Actual error: %v" , err )
215219 }
216220}
@@ -222,7 +226,7 @@ func TestNilRemoteDriver(t *testing.T) {
222226 t .Fatal ("Expected to fail. But instead succeeded" )
223227 }
224228
225- if ! errdefs . IsNotFound (err ) {
229+ if ! isNotFound (err ) {
226230 t .Fatalf ("Did not fail with expected error. Actual error: %v" , err )
227231 }
228232}
@@ -1405,7 +1409,7 @@ func TestValidRemoteDriver(t *testing.T) {
14051409 libnetwork .NetworkOptionGeneric (getEmptyGenericOption ()))
14061410 if err != nil {
14071411 // Only fail if we could not find the plugin driver
1408- if errdefs . IsNotFound (err ) {
1412+ if isNotFound (err ) {
14091413 t .Fatal (err )
14101414 }
14111415 return
0 commit comments