Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
| ... | ... |
@@ -10,10 +10,10 @@ import ( |
| 10 | 10 |
"strings" |
| 11 | 11 |
"testing" |
| 12 | 12 |
|
| 13 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 13 | 14 |
"github.com/docker/docker/api/types/build" |
| 14 | 15 |
"github.com/docker/docker/api/types/container" |
| 15 | 16 |
"github.com/docker/docker/api/types/registry" |
| 16 |
- "github.com/docker/docker/errdefs" |
|
| 17 | 17 |
"gotest.tools/v3/assert" |
| 18 | 18 |
is "gotest.tools/v3/assert/cmp" |
| 19 | 19 |
) |
| ... | ... |
@@ -23,7 +23,7 @@ func TestImageBuildError(t *testing.T) {
|
| 23 | 23 |
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), |
| 24 | 24 |
} |
| 25 | 25 |
_, err := client.ImageBuild(context.Background(), nil, build.ImageBuildOptions{})
|
| 26 |
- assert.Check(t, is.ErrorType(err, errdefs.IsSystem)) |
|
| 26 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
|
| 27 | 27 |
} |
| 28 | 28 |
|
| 29 | 29 |
func TestImageBuild(t *testing.T) {
|
| ... | ... |
@@ -9,9 +9,9 @@ import ( |
| 9 | 9 |
"strings" |
| 10 | 10 |
"testing" |
| 11 | 11 |
|
| 12 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 12 | 13 |
"github.com/docker/docker/api/types/image" |
| 13 | 14 |
"github.com/docker/docker/api/types/registry" |
| 14 |
- "github.com/docker/docker/errdefs" |
|
| 15 | 15 |
"gotest.tools/v3/assert" |
| 16 | 16 |
is "gotest.tools/v3/assert/cmp" |
| 17 | 17 |
) |
| ... | ... |
@@ -21,7 +21,7 @@ func TestImageCreateError(t *testing.T) {
|
| 21 | 21 |
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), |
| 22 | 22 |
} |
| 23 | 23 |
_, err := client.ImageCreate(context.Background(), "reference", image.CreateOptions{})
|
| 24 |
- assert.Check(t, is.ErrorType(err, errdefs.IsSystem)) |
|
| 24 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
|
| 25 | 25 |
} |
| 26 | 26 |
|
| 27 | 27 |
func TestImageCreate(t *testing.T) {
|
| ... | ... |
@@ -7,8 +7,8 @@ import ( |
| 7 | 7 |
"strings" |
| 8 | 8 |
"testing" |
| 9 | 9 |
|
| 10 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 10 | 11 |
"github.com/docker/docker/api/types/image" |
| 11 |
- "github.com/docker/docker/errdefs" |
|
| 12 | 12 |
ocispec "github.com/opencontainers/image-spec/specs-go/v1" |
| 13 | 13 |
"gotest.tools/v3/assert" |
| 14 | 14 |
is "gotest.tools/v3/assert/cmp" |
| ... | ... |
@@ -19,7 +19,7 @@ func TestImageHistoryError(t *testing.T) {
|
| 19 | 19 |
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), |
| 20 | 20 |
} |
| 21 | 21 |
_, err := client.ImageHistory(context.Background(), "nothing") |
| 22 |
- assert.Check(t, is.ErrorType(err, errdefs.IsSystem)) |
|
| 22 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
|
| 23 | 23 |
} |
| 24 | 24 |
|
| 25 | 25 |
func TestImageHistory(t *testing.T) {
|
| ... | ... |
@@ -9,8 +9,8 @@ import ( |
| 9 | 9 |
"strings" |
| 10 | 10 |
"testing" |
| 11 | 11 |
|
| 12 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 12 | 13 |
"github.com/docker/docker/api/types/image" |
| 13 |
- "github.com/docker/docker/errdefs" |
|
| 14 | 14 |
"gotest.tools/v3/assert" |
| 15 | 15 |
is "gotest.tools/v3/assert/cmp" |
| 16 | 16 |
) |
| ... | ... |
@@ -20,7 +20,7 @@ func TestImageImportError(t *testing.T) {
|
| 20 | 20 |
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), |
| 21 | 21 |
} |
| 22 | 22 |
_, err := client.ImageImport(context.Background(), image.ImportSource{}, "image:tag", image.ImportOptions{})
|
| 23 |
- assert.Check(t, is.ErrorType(err, errdefs.IsSystem)) |
|
| 23 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
|
| 24 | 24 |
} |
| 25 | 25 |
|
| 26 | 26 |
func TestImageImport(t *testing.T) {
|
| ... | ... |
@@ -11,8 +11,8 @@ import ( |
| 11 | 11 |
"strings" |
| 12 | 12 |
"testing" |
| 13 | 13 |
|
| 14 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 14 | 15 |
"github.com/docker/docker/api/types/image" |
| 15 |
- "github.com/docker/docker/errdefs" |
|
| 16 | 16 |
ocispec "github.com/opencontainers/image-spec/specs-go/v1" |
| 17 | 17 |
"gotest.tools/v3/assert" |
| 18 | 18 |
is "gotest.tools/v3/assert/cmp" |
| ... | ... |
@@ -24,7 +24,7 @@ func TestImageInspectError(t *testing.T) {
|
| 24 | 24 |
} |
| 25 | 25 |
|
| 26 | 26 |
_, err := client.ImageInspect(context.Background(), "nothing") |
| 27 |
- assert.Check(t, is.ErrorType(err, errdefs.IsSystem)) |
|
| 27 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
|
| 28 | 28 |
} |
| 29 | 29 |
|
| 30 | 30 |
func TestImageInspectImageNotFound(t *testing.T) {
|
| ... | ... |
@@ -33,7 +33,7 @@ func TestImageInspectImageNotFound(t *testing.T) {
|
| 33 | 33 |
} |
| 34 | 34 |
|
| 35 | 35 |
_, err := client.ImageInspect(context.Background(), "unknown") |
| 36 |
- assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) |
|
| 36 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
func TestImageInspectWithEmptyID(t *testing.T) {
|
| ... | ... |
@@ -43,7 +43,7 @@ func TestImageInspectWithEmptyID(t *testing.T) {
|
| 43 | 43 |
}), |
| 44 | 44 |
} |
| 45 | 45 |
_, err := client.ImageInspect(context.Background(), "") |
| 46 |
- assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) |
|
| 46 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
|
| 47 | 47 |
} |
| 48 | 48 |
|
| 49 | 49 |
func TestImageInspect(t *testing.T) {
|
| ... | ... |
@@ -11,9 +11,9 @@ import ( |
| 11 | 11 |
"strings" |
| 12 | 12 |
"testing" |
| 13 | 13 |
|
| 14 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 14 | 15 |
"github.com/docker/docker/api/types/filters" |
| 15 | 16 |
"github.com/docker/docker/api/types/image" |
| 16 |
- "github.com/docker/docker/errdefs" |
|
| 17 | 17 |
"gotest.tools/v3/assert" |
| 18 | 18 |
is "gotest.tools/v3/assert/cmp" |
| 19 | 19 |
) |
| ... | ... |
@@ -24,7 +24,7 @@ func TestImageListError(t *testing.T) {
|
| 24 | 24 |
} |
| 25 | 25 |
|
| 26 | 26 |
_, err := client.ImageList(context.Background(), image.ListOptions{})
|
| 27 |
- assert.Check(t, is.ErrorType(err, errdefs.IsSystem)) |
|
| 27 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
|
| 28 | 28 |
} |
| 29 | 29 |
|
| 30 | 30 |
// TestImageListConnectionError verifies that connection errors occurring |
| ... | ... |
@@ -8,7 +8,7 @@ import ( |
| 8 | 8 |
"net/url" |
| 9 | 9 |
"testing" |
| 10 | 10 |
|
| 11 |
- "github.com/docker/docker/errdefs" |
|
| 11 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 12 | 12 |
ocispec "github.com/opencontainers/image-spec/specs-go/v1" |
| 13 | 13 |
"gotest.tools/v3/assert" |
| 14 | 14 |
is "gotest.tools/v3/assert/cmp" |
| ... | ... |
@@ -20,7 +20,7 @@ func TestImageLoadError(t *testing.T) {
|
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 | 22 |
_, err := client.ImageLoad(context.Background(), nil, ImageLoadWithQuiet(true)) |
| 23 |
- assert.Check(t, is.ErrorType(err, errdefs.IsSystem)) |
|
| 23 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
|
| 24 | 24 |
} |
| 25 | 25 |
|
| 26 | 26 |
func TestImageLoad(t *testing.T) {
|
| ... | ... |
@@ -10,8 +10,8 @@ import ( |
| 10 | 10 |
"strings" |
| 11 | 11 |
"testing" |
| 12 | 12 |
|
| 13 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 13 | 14 |
"github.com/docker/docker/api/types/image" |
| 14 |
- "github.com/docker/docker/errdefs" |
|
| 15 | 15 |
|
| 16 | 16 |
"github.com/docker/docker/api/types/filters" |
| 17 | 17 |
"gotest.tools/v3/assert" |
| ... | ... |
@@ -25,7 +25,7 @@ func TestImagesPruneError(t *testing.T) {
|
| 25 | 25 |
} |
| 26 | 26 |
|
| 27 | 27 |
_, err := client.ImagesPrune(context.Background(), filters.NewArgs()) |
| 28 |
- assert.Check(t, is.ErrorType(err, errdefs.IsSystem)) |
|
| 28 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
|
| 29 | 29 |
} |
| 30 | 30 |
|
| 31 | 31 |
func TestImagesPrune(t *testing.T) {
|
| ... | ... |
@@ -6,9 +6,9 @@ import ( |
| 6 | 6 |
"net/url" |
| 7 | 7 |
"strings" |
| 8 | 8 |
|
| 9 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 9 | 10 |
"github.com/distribution/reference" |
| 10 | 11 |
"github.com/docker/docker/api/types/image" |
| 11 |
- "github.com/docker/docker/errdefs" |
|
| 12 | 12 |
) |
| 13 | 13 |
|
| 14 | 14 |
// ImagePull requests the docker host to pull an image from a remote registry. |
| ... | ... |
@@ -35,7 +35,7 @@ func (cli *Client) ImagePull(ctx context.Context, refStr string, options image.P |
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 | 37 |
resp, err := cli.tryImageCreate(ctx, query, options.RegistryAuth) |
| 38 |
- if errdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil {
|
|
| 38 |
+ if cerrdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil {
|
|
| 39 | 39 |
newAuthHeader, privilegeErr := options.PrivilegeFunc(ctx) |
| 40 | 40 |
if privilegeErr != nil {
|
| 41 | 41 |
return nil, privilegeErr |
| ... | ... |
@@ -9,9 +9,9 @@ import ( |
| 9 | 9 |
"strings" |
| 10 | 10 |
"testing" |
| 11 | 11 |
|
| 12 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 12 | 13 |
"github.com/docker/docker/api/types/image" |
| 13 | 14 |
"github.com/docker/docker/api/types/registry" |
| 14 |
- "github.com/docker/docker/errdefs" |
|
| 15 | 15 |
"gotest.tools/v3/assert" |
| 16 | 16 |
is "gotest.tools/v3/assert/cmp" |
| 17 | 17 |
) |
| ... | ... |
@@ -32,7 +32,7 @@ func TestImagePullAnyError(t *testing.T) {
|
| 32 | 32 |
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), |
| 33 | 33 |
} |
| 34 | 34 |
_, err := client.ImagePull(context.Background(), "myimage", image.PullOptions{})
|
| 35 |
- assert.Check(t, is.ErrorType(err, errdefs.IsSystem)) |
|
| 35 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
|
| 36 | 36 |
} |
| 37 | 37 |
|
| 38 | 38 |
func TestImagePullStatusUnauthorizedError(t *testing.T) {
|
| ... | ... |
@@ -40,7 +40,7 @@ func TestImagePullStatusUnauthorizedError(t *testing.T) {
|
| 40 | 40 |
client: newMockClient(errorMock(http.StatusUnauthorized, "Unauthorized error")), |
| 41 | 41 |
} |
| 42 | 42 |
_, err := client.ImagePull(context.Background(), "myimage", image.PullOptions{})
|
| 43 |
- assert.Check(t, is.ErrorType(err, errdefs.IsUnauthorized)) |
|
| 43 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsUnauthorized)) |
|
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 | 46 |
func TestImagePullWithUnauthorizedErrorAndPrivilegeFuncError(t *testing.T) {
|
| ... | ... |
@@ -66,7 +66,7 @@ func TestImagePullWithUnauthorizedErrorAndAnotherUnauthorizedError(t *testing.T) |
| 66 | 66 |
_, err := client.ImagePull(context.Background(), "myimage", image.PullOptions{
|
| 67 | 67 |
PrivilegeFunc: privilegeFunc, |
| 68 | 68 |
}) |
| 69 |
- assert.Check(t, is.ErrorType(err, errdefs.IsUnauthorized)) |
|
| 69 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsUnauthorized)) |
|
| 70 | 70 |
} |
| 71 | 71 |
|
| 72 | 72 |
func TestImagePullWithPrivilegedFuncNoError(t *testing.T) {
|
| ... | ... |
@@ -9,10 +9,10 @@ import ( |
| 9 | 9 |
"net/http" |
| 10 | 10 |
"net/url" |
| 11 | 11 |
|
| 12 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 12 | 13 |
"github.com/distribution/reference" |
| 13 | 14 |
"github.com/docker/docker/api/types/image" |
| 14 | 15 |
"github.com/docker/docker/api/types/registry" |
| 15 |
- "github.com/docker/docker/errdefs" |
|
| 16 | 16 |
) |
| 17 | 17 |
|
| 18 | 18 |
// ImagePush requests the docker host to push an image to a remote registry. |
| ... | ... |
@@ -52,7 +52,7 @@ func (cli *Client) ImagePush(ctx context.Context, image string, options image.Pu |
| 52 | 52 |
} |
| 53 | 53 |
|
| 54 | 54 |
resp, err := cli.tryImagePush(ctx, ref.Name(), query, options.RegistryAuth) |
| 55 |
- if errdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil {
|
|
| 55 |
+ if cerrdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil {
|
|
| 56 | 56 |
newAuthHeader, privilegeErr := options.PrivilegeFunc(ctx) |
| 57 | 57 |
if privilegeErr != nil {
|
| 58 | 58 |
return nil, privilegeErr |
| ... | ... |
@@ -9,9 +9,9 @@ import ( |
| 9 | 9 |
"strings" |
| 10 | 10 |
"testing" |
| 11 | 11 |
|
| 12 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 12 | 13 |
"github.com/docker/docker/api/types/image" |
| 13 | 14 |
"github.com/docker/docker/api/types/registry" |
| 14 |
- "github.com/docker/docker/errdefs" |
|
| 15 | 15 |
"gotest.tools/v3/assert" |
| 16 | 16 |
is "gotest.tools/v3/assert/cmp" |
| 17 | 17 |
) |
| ... | ... |
@@ -35,7 +35,7 @@ func TestImagePushAnyError(t *testing.T) {
|
| 35 | 35 |
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), |
| 36 | 36 |
} |
| 37 | 37 |
_, err := client.ImagePush(context.Background(), "myimage", image.PushOptions{})
|
| 38 |
- assert.Check(t, is.ErrorType(err, errdefs.IsSystem)) |
|
| 38 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
|
| 39 | 39 |
} |
| 40 | 40 |
|
| 41 | 41 |
func TestImagePushStatusUnauthorizedError(t *testing.T) {
|
| ... | ... |
@@ -43,7 +43,7 @@ func TestImagePushStatusUnauthorizedError(t *testing.T) {
|
| 43 | 43 |
client: newMockClient(errorMock(http.StatusUnauthorized, "Unauthorized error")), |
| 44 | 44 |
} |
| 45 | 45 |
_, err := client.ImagePush(context.Background(), "myimage", image.PushOptions{})
|
| 46 |
- assert.Check(t, is.ErrorType(err, errdefs.IsUnauthorized)) |
|
| 46 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsUnauthorized)) |
|
| 47 | 47 |
} |
| 48 | 48 |
|
| 49 | 49 |
func TestImagePushWithUnauthorizedErrorAndPrivilegeFuncError(t *testing.T) {
|
| ... | ... |
@@ -69,7 +69,7 @@ func TestImagePushWithUnauthorizedErrorAndAnotherUnauthorizedError(t *testing.T) |
| 69 | 69 |
_, err := client.ImagePush(context.Background(), "myimage", image.PushOptions{
|
| 70 | 70 |
PrivilegeFunc: privilegeFunc, |
| 71 | 71 |
}) |
| 72 |
- assert.Check(t, is.ErrorType(err, errdefs.IsUnauthorized)) |
|
| 72 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsUnauthorized)) |
|
| 73 | 73 |
} |
| 74 | 74 |
|
| 75 | 75 |
func TestImagePushWithPrivilegedFuncNoError(t *testing.T) {
|
| ... | ... |
@@ -10,8 +10,8 @@ import ( |
| 10 | 10 |
"strings" |
| 11 | 11 |
"testing" |
| 12 | 12 |
|
| 13 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 13 | 14 |
"github.com/docker/docker/api/types/image" |
| 14 |
- "github.com/docker/docker/errdefs" |
|
| 15 | 15 |
"gotest.tools/v3/assert" |
| 16 | 16 |
is "gotest.tools/v3/assert/cmp" |
| 17 | 17 |
) |
| ... | ... |
@@ -22,7 +22,7 @@ func TestImageRemoveError(t *testing.T) {
|
| 22 | 22 |
} |
| 23 | 23 |
|
| 24 | 24 |
_, err := client.ImageRemove(context.Background(), "image_id", image.RemoveOptions{})
|
| 25 |
- assert.Check(t, is.ErrorType(err, errdefs.IsSystem)) |
|
| 25 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
|
| 26 | 26 |
} |
| 27 | 27 |
|
| 28 | 28 |
func TestImageRemoveImageNotFound(t *testing.T) {
|
| ... | ... |
@@ -32,7 +32,7 @@ func TestImageRemoveImageNotFound(t *testing.T) {
|
| 32 | 32 |
|
| 33 | 33 |
_, err := client.ImageRemove(context.Background(), "unknown", image.RemoveOptions{})
|
| 34 | 34 |
assert.Check(t, is.ErrorContains(err, "no such image: unknown")) |
| 35 |
- assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) |
|
| 35 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
|
| 36 | 36 |
} |
| 37 | 37 |
|
| 38 | 38 |
func TestImageRemove(t *testing.T) {
|
| ... | ... |
@@ -8,7 +8,7 @@ import ( |
| 8 | 8 |
"net/url" |
| 9 | 9 |
"testing" |
| 10 | 10 |
|
| 11 |
- "github.com/docker/docker/errdefs" |
|
| 11 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 12 | 12 |
ocispec "github.com/opencontainers/image-spec/specs-go/v1" |
| 13 | 13 |
"gotest.tools/v3/assert" |
| 14 | 14 |
is "gotest.tools/v3/assert/cmp" |
| ... | ... |
@@ -20,7 +20,7 @@ func TestImageSaveError(t *testing.T) {
|
| 20 | 20 |
} |
| 21 | 21 |
armv64 := ocispec.Platform{Architecture: "arm64", OS: "linux", Variant: "v8"}
|
| 22 | 22 |
_, err := client.ImageSave(context.Background(), []string{"nothing"}, ImageSaveWithPlatforms(armv64))
|
| 23 |
- assert.Check(t, is.ErrorType(err, errdefs.IsSystem)) |
|
| 23 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
|
| 24 | 24 |
} |
| 25 | 25 |
|
| 26 | 26 |
func TestImageSave(t *testing.T) {
|
| ... | ... |
@@ -7,9 +7,9 @@ import ( |
| 7 | 7 |
"net/url" |
| 8 | 8 |
"strconv" |
| 9 | 9 |
|
| 10 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 10 | 11 |
"github.com/docker/docker/api/types/filters" |
| 11 | 12 |
"github.com/docker/docker/api/types/registry" |
| 12 |
- "github.com/docker/docker/errdefs" |
|
| 13 | 13 |
) |
| 14 | 14 |
|
| 15 | 15 |
// ImageSearch makes the docker host search by a term in a remote registry. |
| ... | ... |
@@ -32,7 +32,7 @@ func (cli *Client) ImageSearch(ctx context.Context, term string, options registr |
| 32 | 32 |
|
| 33 | 33 |
resp, err := cli.tryImageSearch(ctx, query, options.RegistryAuth) |
| 34 | 34 |
defer ensureReaderClosed(resp) |
| 35 |
- if errdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil {
|
|
| 35 |
+ if cerrdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil {
|
|
| 36 | 36 |
newAuthHeader, privilegeErr := options.PrivilegeFunc(ctx) |
| 37 | 37 |
if privilegeErr != nil {
|
| 38 | 38 |
return results, privilegeErr |
| ... | ... |
@@ -10,9 +10,9 @@ import ( |
| 10 | 10 |
"strings" |
| 11 | 11 |
"testing" |
| 12 | 12 |
|
| 13 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 13 | 14 |
"github.com/docker/docker/api/types/filters" |
| 14 | 15 |
"github.com/docker/docker/api/types/registry" |
| 15 |
- "github.com/docker/docker/errdefs" |
|
| 16 | 16 |
"gotest.tools/v3/assert" |
| 17 | 17 |
is "gotest.tools/v3/assert/cmp" |
| 18 | 18 |
) |
| ... | ... |
@@ -22,7 +22,7 @@ func TestImageSearchAnyError(t *testing.T) {
|
| 22 | 22 |
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), |
| 23 | 23 |
} |
| 24 | 24 |
_, err := client.ImageSearch(context.Background(), "some-image", registry.SearchOptions{})
|
| 25 |
- assert.Check(t, is.ErrorType(err, errdefs.IsSystem)) |
|
| 25 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
|
| 26 | 26 |
} |
| 27 | 27 |
|
| 28 | 28 |
func TestImageSearchStatusUnauthorizedError(t *testing.T) {
|
| ... | ... |
@@ -30,7 +30,7 @@ func TestImageSearchStatusUnauthorizedError(t *testing.T) {
|
| 30 | 30 |
client: newMockClient(errorMock(http.StatusUnauthorized, "Unauthorized error")), |
| 31 | 31 |
} |
| 32 | 32 |
_, err := client.ImageSearch(context.Background(), "some-image", registry.SearchOptions{})
|
| 33 |
- assert.Check(t, is.ErrorType(err, errdefs.IsUnauthorized)) |
|
| 33 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsUnauthorized)) |
|
| 34 | 34 |
} |
| 35 | 35 |
|
| 36 | 36 |
func TestImageSearchWithUnauthorizedErrorAndPrivilegeFuncError(t *testing.T) {
|
| ... | ... |
@@ -56,7 +56,7 @@ func TestImageSearchWithUnauthorizedErrorAndAnotherUnauthorizedError(t *testing. |
| 56 | 56 |
_, err := client.ImageSearch(context.Background(), "some-image", registry.SearchOptions{
|
| 57 | 57 |
PrivilegeFunc: privilegeFunc, |
| 58 | 58 |
}) |
| 59 |
- assert.Check(t, is.ErrorType(err, errdefs.IsUnauthorized)) |
|
| 59 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsUnauthorized)) |
|
| 60 | 60 |
} |
| 61 | 61 |
|
| 62 | 62 |
func TestImageSearchWithPrivilegedFuncNoError(t *testing.T) {
|
| ... | ... |
@@ -9,7 +9,7 @@ import ( |
| 9 | 9 |
"strings" |
| 10 | 10 |
"testing" |
| 11 | 11 |
|
| 12 |
- "github.com/docker/docker/errdefs" |
|
| 12 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 13 | 13 |
"github.com/docker/docker/testutil" |
| 14 | 14 |
"gotest.tools/v3/assert" |
| 15 | 15 |
is "gotest.tools/v3/assert/cmp" |
| ... | ... |
@@ -21,7 +21,7 @@ func TestImageTagError(t *testing.T) {
|
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 | 23 |
err := client.ImageTag(context.Background(), "image_id", "repo:tag") |
| 24 |
- assert.Check(t, is.ErrorType(err, errdefs.IsSystem)) |
|
| 24 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
|
| 25 | 25 |
} |
| 26 | 26 |
|
| 27 | 27 |
// Note: this is not testing all the InvalidReference as it's the responsibility |