client/image: use containerd errdefs checks

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski
2025-05-19 14:14:05 +02:00
committed by Sebastiaan van Stijn
parent 370b7e65fc
commit a1035ec59b
17 changed files with 43 additions and 43 deletions

View File

@@ -9,9 +9,9 @@ import (
"strings"
"testing"
cerrdefs "github.com/containerd/errdefs"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/registry"
"github.com/docker/docker/errdefs"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
@@ -32,7 +32,7 @@ func TestImagePullAnyError(t *testing.T) {
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
}
_, err := client.ImagePull(context.Background(), "myimage", image.PullOptions{})
assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
}
func TestImagePullStatusUnauthorizedError(t *testing.T) {
@@ -40,7 +40,7 @@ func TestImagePullStatusUnauthorizedError(t *testing.T) {
client: newMockClient(errorMock(http.StatusUnauthorized, "Unauthorized error")),
}
_, err := client.ImagePull(context.Background(), "myimage", image.PullOptions{})
assert.Check(t, is.ErrorType(err, errdefs.IsUnauthorized))
assert.Check(t, is.ErrorType(err, cerrdefs.IsUnauthorized))
}
func TestImagePullWithUnauthorizedErrorAndPrivilegeFuncError(t *testing.T) {
@@ -66,7 +66,7 @@ func TestImagePullWithUnauthorizedErrorAndAnotherUnauthorizedError(t *testing.T)
_, err := client.ImagePull(context.Background(), "myimage", image.PullOptions{
PrivilegeFunc: privilegeFunc,
})
assert.Check(t, is.ErrorType(err, errdefs.IsUnauthorized))
assert.Check(t, is.ErrorType(err, cerrdefs.IsUnauthorized))
}
func TestImagePullWithPrivilegedFuncNoError(t *testing.T) {