summaryrefslogtreecommitdiff
path: root/client/image_push_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'client/image_push_test.go')
-rw-r--r--client/image_push_test.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/client/image_push_test.go b/client/image_push_test.go
index ebf61572b7..d39af7d410 100644
--- a/client/image_push_test.go
+++ b/client/image_push_test.go
@@ -12,6 +12,8 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/registry"
"github.com/docker/docker/errdefs"
+ "gotest.tools/v3/assert"
+ is "gotest.tools/v3/assert/cmp"
)
func TestImagePushReferenceError(t *testing.T) {
@@ -37,9 +39,7 @@ func TestImagePushAnyError(t *testing.T) {
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
}
_, err := client.ImagePush(context.Background(), "myimage", types.ImagePushOptions{})
- if !errdefs.IsSystem(err) {
- t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
- }
+ assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
}
func TestImagePushStatusUnauthorizedError(t *testing.T) {
@@ -47,9 +47,7 @@ func TestImagePushStatusUnauthorizedError(t *testing.T) {
client: newMockClient(errorMock(http.StatusUnauthorized, "Unauthorized error")),
}
_, err := client.ImagePush(context.Background(), "myimage", types.ImagePushOptions{})
- if !errdefs.IsUnauthorized(err) {
- t.Fatalf("expected a Unauthorized Error, got %[1]T: %[1]v", err)
- }
+ assert.Check(t, is.ErrorType(err, errdefs.IsUnauthorized))
}
func TestImagePushWithUnauthorizedErrorAndPrivilegeFuncError(t *testing.T) {
@@ -77,9 +75,7 @@ func TestImagePushWithUnauthorizedErrorAndAnotherUnauthorizedError(t *testing.T)
_, err := client.ImagePush(context.Background(), "myimage", types.ImagePushOptions{
PrivilegeFunc: privilegeFunc,
})
- if !errdefs.IsUnauthorized(err) {
- t.Fatalf("expected a Unauthorized Error, got %[1]T: %[1]v", err)
- }
+ assert.Check(t, is.ErrorType(err, errdefs.IsUnauthorized))
}
func TestImagePushWithPrivilegedFuncNoError(t *testing.T) {