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>
This commit is contained in:
Sebastiaan van Stijn 2023-05-10 13:19:14 +02:00
parent 66ff1e063e
commit 0538cdd226
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
3 changed files with 6 additions and 6 deletions

View file

@ -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)

View file

@ -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))
}
})
}

View file

@ -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))
}