summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiaan van Stijn <github@gone.nl>2023-05-10 13:27:56 +0200
committerSebastiaan van Stijn <github@gone.nl>2023-05-10 22:13:50 +0200
commit8d76acfe6cfe6e468764f444cace81c81ed44fcb (patch)
treee1bab33f3fccc7df986bc3421e88ce9680e84ec9
parent56fb56ccf030746bcdcf9803df0f848c156a4592 (diff)
downloaddocker-8d76acfe6cfe6e468764f444cace81c81ed44fcb.tar.gz
testutil: replace uses of client.IsErrNotFound
The client no longer returns the old error-type, so we can use errdefs instead. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
-rw-r--r--testutil/daemon/plugin.go5
-rw-r--r--testutil/environment/clean.go4
2 files changed, 5 insertions, 4 deletions
diff --git a/testutil/daemon/plugin.go b/testutil/daemon/plugin.go
index 4bf93c79b3..cda017922d 100644
--- a/testutil/daemon/plugin.go
+++ b/testutil/daemon/plugin.go
@@ -6,6 +6,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
+ "github.com/docker/docker/errdefs"
"gotest.tools/v3/poll"
)
@@ -33,7 +34,7 @@ func (d *Daemon) PluginIsNotRunning(t testing.TB, name string) func(poll.LogT) p
func (d *Daemon) PluginIsNotPresent(t testing.TB, name string) func(poll.LogT) poll.Result {
return withClient(t, d, func(c client.APIClient, t poll.LogT) poll.Result {
_, _, err := c.PluginInspectWithRaw(context.Background(), name)
- if client.IsErrNotFound(err) {
+ if errdefs.IsNotFound(err) {
return poll.Success()
}
if err != nil {
@@ -56,7 +57,7 @@ func (d *Daemon) PluginReferenceIs(t testing.TB, name, expectedRef string) func(
func withPluginInspect(name string, f func(*types.Plugin, poll.LogT) poll.Result) func(client.APIClient, poll.LogT) poll.Result {
return func(c client.APIClient, t poll.LogT) poll.Result {
plugin, _, err := c.PluginInspectWithRaw(context.Background(), name)
- if client.IsErrNotFound(err) {
+ if errdefs.IsNotFound(err) {
return poll.Continue("plugin %q not found", name)
}
if err != nil {
diff --git a/testutil/environment/clean.go b/testutil/environment/clean.go
index 74c8339d35..29448bb7b5 100644
--- a/testutil/environment/clean.go
+++ b/testutil/environment/clean.go
@@ -74,7 +74,7 @@ func deleteAllContainers(t testing.TB, apiclient client.ContainerAPIClient, prot
Force: true,
RemoveVolumes: true,
})
- if err == nil || client.IsErrNotFound(err) || alreadyExists.MatchString(err.Error()) || isErrNotFoundSwarmClassic(err) {
+ if err == nil || errdefs.IsNotFound(err) || alreadyExists.MatchString(err.Error()) || isErrNotFoundSwarmClassic(err) {
continue
}
assert.Check(t, err, "failed to remove %s", container.ID)
@@ -115,7 +115,7 @@ func removeImage(ctx context.Context, t testing.TB, apiclient client.ImageAPICli
_, err := apiclient.ImageRemove(ctx, ref, types.ImageRemoveOptions{
Force: true,
})
- if client.IsErrNotFound(err) {
+ if errdefs.IsNotFound(err) {
return
}
assert.Check(t, err, "failed to remove image %s", ref)