diff options
author | Sebastiaan van Stijn <github@gone.nl> | 2023-05-10 13:19:14 +0200 |
---|---|---|
committer | Sebastiaan van Stijn <github@gone.nl> | 2023-05-10 22:13:50 +0200 |
commit | 0538cdd226e0394aa604b8f36f4a3cd98c27e56f (patch) | |
tree | 6cb11a2f69a2d748c87ae80d4ef431c52e41146e | |
parent | 66ff1e063eac6626658bafaa034a2ef9af9ad290 (diff) | |
download | docker-0538cdd226e0394aa604b8f36f4a3cd98c27e56f.tar.gz |
integration-cli: update error-assertions in tests
- use is.ErrorType
- replace uses of client.IsErrNotFound for errdefs.IsNotFound, as
the client no longer returns the old error-type.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
-rw-r--r-- | integration-cli/daemon/daemon_swarm.go | 6 | ||||
-rw-r--r-- | integration-cli/docker_api_containers_test.go | 2 | ||||
-rw-r--r-- | integration-cli/docker_api_swarm_test.go | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/integration-cli/daemon/daemon_swarm.go b/integration-cli/daemon/daemon_swarm.go index 40e6bada2a..8ac72cef0a 100644 --- a/integration-cli/daemon/daemon_swarm.go +++ b/integration-cli/daemon/daemon_swarm.go @@ -9,7 +9,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/swarm" - "github.com/docker/docker/client" + "github.com/docker/docker/errdefs" "gotest.tools/v3/assert" ) @@ -68,7 +68,7 @@ func (d *Daemon) CheckPluginRunning(plugin string) func(c *testing.T) (interface return func(c *testing.T) (interface{}, string) { apiclient := d.NewClientT(c) resp, _, err := apiclient.PluginInspectWithRaw(context.Background(), plugin) - if client.IsErrNotFound(err) { + if errdefs.IsNotFound(err) { return false, fmt.Sprintf("%v", err) } assert.NilError(c, err) @@ -81,7 +81,7 @@ func (d *Daemon) CheckPluginImage(plugin string) func(c *testing.T) (interface{} return func(c *testing.T) (interface{}, string) { apiclient := d.NewClientT(c) resp, _, err := apiclient.PluginInspectWithRaw(context.Background(), plugin) - if client.IsErrNotFound(err) { + if errdefs.IsNotFound(err) { return false, fmt.Sprintf("%v", err) } assert.NilError(c, err) diff --git a/integration-cli/docker_api_containers_test.go b/integration-cli/docker_api_containers_test.go index d89c605f51..bbb2fc4df6 100644 --- a/integration-cli/docker_api_containers_test.go +++ b/integration-cli/docker_api_containers_test.go @@ -2153,7 +2153,7 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsCreate(c *testing.T) { // anonymous volumes are removed default: _, err := apiclient.VolumeInspect(ctx, mountPoint.Name) - assert.Check(c, client.IsErrNotFound(err)) + assert.Check(c, is.ErrorType(err, errdefs.IsNotFound)) } }) } diff --git a/integration-cli/docker_api_swarm_test.go b/integration-cli/docker_api_swarm_test.go index 8182f85ed8..dc3d18c828 100644 --- a/integration-cli/docker_api_swarm_test.go +++ b/integration-cli/docker_api_swarm_test.go @@ -22,7 +22,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/swarm" - "github.com/docker/docker/client" + "github.com/docker/docker/errdefs" "github.com/docker/docker/integration-cli/checker" "github.com/docker/docker/integration-cli/daemon" testdaemon "github.com/docker/docker/testutil/daemon" @@ -1042,5 +1042,5 @@ func (s *DockerSwarmSuite) TestAPINetworkInspectWithScope(c *testing.T) { assert.Check(c, is.Equal(resp.ID, network.ID)) _, err = apiclient.NetworkInspect(ctx, name, types.NetworkInspectOptions{Scope: "local"}) - assert.Check(c, client.IsErrNotFound(err)) + assert.Check(c, is.ErrorType(err, errdefs.IsNotFound)) } |