Browse code

client: 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>

Sebastiaan van Stijn authored on 2023/05/10 20:17:40
Showing 93 changed files
... ...
@@ -12,6 +12,8 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestCheckpointCreateError(t *testing.T) {
... ...
@@ -23,9 +25,7 @@ func TestCheckpointCreateError(t *testing.T) {
23 23
 		Exit:         true,
24 24
 	})
25 25
 
26
-	if !errdefs.IsSystem(err) {
27
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
28
-	}
26
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
29 27
 }
30 28
 
31 29
 func TestCheckpointCreate(t *testing.T) {
... ...
@@ -11,6 +11,8 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/api/types"
13 13
 	"github.com/docker/docker/errdefs"
14
+	"gotest.tools/v3/assert"
15
+	is "gotest.tools/v3/assert/cmp"
14 16
 )
15 17
 
16 18
 func TestCheckpointDeleteError(t *testing.T) {
... ...
@@ -22,9 +24,7 @@ func TestCheckpointDeleteError(t *testing.T) {
22 22
 		CheckpointID: "checkpoint_id",
23 23
 	})
24 24
 
25
-	if !errdefs.IsSystem(err) {
26
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
27
-	}
25
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
28 26
 }
29 27
 
30 28
 func TestCheckpointDelete(t *testing.T) {
... ...
@@ -12,6 +12,8 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestCheckpointListError(t *testing.T) {
... ...
@@ -20,9 +22,7 @@ func TestCheckpointListError(t *testing.T) {
20 20
 	}
21 21
 
22 22
 	_, err := client.CheckpointList(context.Background(), "container_id", types.CheckpointListOptions{})
23
-	if !errdefs.IsSystem(err) {
24
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
25
-	}
23
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
26 24
 }
27 25
 
28 26
 func TestCheckpointList(t *testing.T) {
... ...
@@ -63,7 +63,5 @@ func TestCheckpointListContainerNotFound(t *testing.T) {
63 63
 	}
64 64
 
65 65
 	_, err := client.CheckpointList(context.Background(), "unknown", types.CheckpointListOptions{})
66
-	if err == nil || !IsErrNotFound(err) {
67
-		t.Fatalf("expected a containerNotFound error, got %v", err)
68
-	}
66
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
69 67
 }
... ...
@@ -32,9 +32,7 @@ func TestConfigCreateError(t *testing.T) {
32 32
 		client:  newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
33 33
 	}
34 34
 	_, err := client.ConfigCreate(context.Background(), swarm.ConfigSpec{})
35
-	if !errdefs.IsSystem(err) {
36
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
37
-	}
35
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
38 36
 }
39 37
 
40 38
 func TestConfigCreate(t *testing.T) {
... ...
@@ -23,9 +23,7 @@ func TestConfigInspectNotFound(t *testing.T) {
23 23
 	}
24 24
 
25 25
 	_, _, err := client.ConfigInspectWithRaw(context.Background(), "unknown")
26
-	if err == nil || !IsErrNotFound(err) {
27
-		t.Fatalf("expected a NotFoundError error, got %v", err)
28
-	}
26
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
29 27
 }
30 28
 
31 29
 func TestConfigInspectWithEmptyID(t *testing.T) {
... ...
@@ -35,9 +33,7 @@ func TestConfigInspectWithEmptyID(t *testing.T) {
35 35
 		}),
36 36
 	}
37 37
 	_, _, err := client.ConfigInspectWithRaw(context.Background(), "")
38
-	if !IsErrNotFound(err) {
39
-		t.Fatalf("Expected NotFoundError, got %v", err)
40
-	}
38
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
41 39
 }
42 40
 
43 41
 func TestConfigInspectUnsupported(t *testing.T) {
... ...
@@ -56,9 +52,7 @@ func TestConfigInspectError(t *testing.T) {
56 56
 	}
57 57
 
58 58
 	_, _, err := client.ConfigInspectWithRaw(context.Background(), "nothing")
59
-	if !errdefs.IsSystem(err) {
60
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
61
-	}
59
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
62 60
 }
63 61
 
64 62
 func TestConfigInspectConfigNotFound(t *testing.T) {
... ...
@@ -68,9 +62,7 @@ func TestConfigInspectConfigNotFound(t *testing.T) {
68 68
 	}
69 69
 
70 70
 	_, _, err := client.ConfigInspectWithRaw(context.Background(), "unknown")
71
-	if err == nil || !IsErrNotFound(err) {
72
-		t.Fatalf("expected a configNotFoundError error, got %v", err)
73
-	}
71
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
74 72
 }
75 73
 
76 74
 func TestConfigInspect(t *testing.T) {
... ...
@@ -34,9 +34,7 @@ func TestConfigListError(t *testing.T) {
34 34
 	}
35 35
 
36 36
 	_, err := client.ConfigList(context.Background(), types.ConfigListOptions{})
37
-	if !errdefs.IsSystem(err) {
38
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
39
-	}
37
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
40 38
 }
41 39
 
42 40
 func TestConfigList(t *testing.T) {
... ...
@@ -30,9 +30,7 @@ func TestConfigRemoveError(t *testing.T) {
30 30
 	}
31 31
 
32 32
 	err := client.ConfigRemove(context.Background(), "config_id")
33
-	if !errdefs.IsSystem(err) {
34
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
35
-	}
33
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
36 34
 }
37 35
 
38 36
 func TestConfigRemove(t *testing.T) {
... ...
@@ -31,9 +31,7 @@ func TestConfigUpdateError(t *testing.T) {
31 31
 	}
32 32
 
33 33
 	err := client.ConfigUpdate(context.Background(), "config_id", swarm.Version{}, swarm.ConfigSpec{})
34
-	if !errdefs.IsSystem(err) {
35
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
36
-	}
34
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
37 35
 }
38 36
 
39 37
 func TestConfigUpdate(t *testing.T) {
... ...
@@ -12,6 +12,8 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestContainerCommitError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestContainerCommitError(t *testing.T) {
19 19
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
20 20
 	}
21 21
 	_, err := client.ContainerCommit(context.Background(), "nothing", types.ContainerCommitOptions{})
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestContainerCommit(t *testing.T) {
... ...
@@ -13,6 +13,8 @@ import (
13 13
 
14 14
 	"github.com/docker/docker/api/types"
15 15
 	"github.com/docker/docker/errdefs"
16
+	"gotest.tools/v3/assert"
17
+	is "gotest.tools/v3/assert/cmp"
16 18
 )
17 19
 
18 20
 func TestContainerStatPathError(t *testing.T) {
... ...
@@ -20,9 +22,7 @@ func TestContainerStatPathError(t *testing.T) {
20 20
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
21 21
 	}
22 22
 	_, err := client.ContainerStatPath(context.Background(), "container_id", "path")
23
-	if !errdefs.IsSystem(err) {
24
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
25
-	}
23
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
26 24
 }
27 25
 
28 26
 func TestContainerStatPathNotFoundError(t *testing.T) {
... ...
@@ -30,9 +30,7 @@ func TestContainerStatPathNotFoundError(t *testing.T) {
30 30
 		client: newMockClient(errorMock(http.StatusNotFound, "Not found")),
31 31
 	}
32 32
 	_, err := client.ContainerStatPath(context.Background(), "container_id", "path")
33
-	if !IsErrNotFound(err) {
34
-		t.Fatalf("expected a not found error, got %v", err)
35
-	}
33
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
36 34
 }
37 35
 
38 36
 func TestContainerStatPathNoHeaderError(t *testing.T) {
... ...
@@ -100,9 +98,7 @@ func TestCopyToContainerError(t *testing.T) {
100 100
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
101 101
 	}
102 102
 	err := client.CopyToContainer(context.Background(), "container_id", "path/to/file", bytes.NewReader([]byte("")), types.CopyToContainerOptions{})
103
-	if !errdefs.IsSystem(err) {
104
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
105
-	}
103
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
106 104
 }
107 105
 
108 106
 func TestCopyToContainerNotFoundError(t *testing.T) {
... ...
@@ -110,9 +106,7 @@ func TestCopyToContainerNotFoundError(t *testing.T) {
110 110
 		client: newMockClient(errorMock(http.StatusNotFound, "Not found")),
111 111
 	}
112 112
 	err := client.CopyToContainer(context.Background(), "container_id", "path/to/file", bytes.NewReader([]byte("")), types.CopyToContainerOptions{})
113
-	if !IsErrNotFound(err) {
114
-		t.Fatalf("expected a not found error, got %v", err)
115
-	}
113
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
116 114
 }
117 115
 
118 116
 // TestCopyToContainerEmptyResponse verifies that no error is returned when a
... ...
@@ -178,9 +172,7 @@ func TestCopyFromContainerError(t *testing.T) {
178 178
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
179 179
 	}
180 180
 	_, _, err := client.CopyFromContainer(context.Background(), "container_id", "path/to/file")
181
-	if !errdefs.IsSystem(err) {
182
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
183
-	}
181
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
184 182
 }
185 183
 
186 184
 func TestCopyFromContainerNotFoundError(t *testing.T) {
... ...
@@ -188,9 +180,7 @@ func TestCopyFromContainerNotFoundError(t *testing.T) {
188 188
 		client: newMockClient(errorMock(http.StatusNotFound, "Not found")),
189 189
 	}
190 190
 	_, _, err := client.CopyFromContainer(context.Background(), "container_id", "path/to/file")
191
-	if !IsErrNotFound(err) {
192
-		t.Fatalf("expected a not found error, got %v", err)
193
-	}
191
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
194 192
 }
195 193
 
196 194
 // TestCopyFromContainerEmptyResponse verifies that no error is returned when a
... ...
@@ -12,6 +12,8 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types/container"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestContainerCreateError(t *testing.T) {
... ...
@@ -19,18 +21,14 @@ func TestContainerCreateError(t *testing.T) {
19 19
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
20 20
 	}
21 21
 	_, err := client.ContainerCreate(context.Background(), nil, nil, nil, nil, "nothing")
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error while testing StatusInternalServerError, got %T", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 
26 24
 	// 404 doesn't automatically means an unknown image
27 25
 	client = &Client{
28 26
 		client: newMockClient(errorMock(http.StatusNotFound, "Server error")),
29 27
 	}
30 28
 	_, err = client.ContainerCreate(context.Background(), nil, nil, nil, nil, "nothing")
31
-	if err == nil || !IsErrNotFound(err) {
32
-		t.Fatalf("expected a Server Error while testing StatusNotFound, got %T", err)
33
-	}
29
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
34 30
 }
35 31
 
36 32
 func TestContainerCreateImageNotFound(t *testing.T) {
... ...
@@ -38,9 +36,7 @@ func TestContainerCreateImageNotFound(t *testing.T) {
38 38
 		client: newMockClient(errorMock(http.StatusNotFound, "No such image")),
39 39
 	}
40 40
 	_, err := client.ContainerCreate(context.Background(), &container.Config{Image: "unknown_image"}, nil, nil, nil, "unknown")
41
-	if err == nil || !IsErrNotFound(err) {
42
-		t.Fatalf("expected an imageNotFound error, got %v, %T", err, err)
43
-	}
41
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
44 42
 }
45 43
 
46 44
 func TestContainerCreateWithName(t *testing.T) {
... ...
@@ -12,6 +12,8 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestContainerExecCreateError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestContainerExecCreateError(t *testing.T) {
19 19
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
20 20
 	}
21 21
 	_, err := client.ContainerExecCreate(context.Background(), "container_id", types.ExecConfig{})
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestContainerExecCreate(t *testing.T) {
... ...
@@ -74,9 +74,7 @@ func TestContainerExecStartError(t *testing.T) {
74 74
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
75 75
 	}
76 76
 	err := client.ContainerExecStart(context.Background(), "nothing", types.ExecStartCheck{})
77
-	if !errdefs.IsSystem(err) {
78
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
79
-	}
77
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
80 78
 }
81 79
 
82 80
 func TestContainerExecStart(t *testing.T) {
... ...
@@ -118,9 +116,7 @@ func TestContainerExecInspectError(t *testing.T) {
118 118
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
119 119
 	}
120 120
 	_, err := client.ContainerExecInspect(context.Background(), "nothing")
121
-	if !errdefs.IsSystem(err) {
122
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
123
-	}
121
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
124 122
 }
125 123
 
126 124
 func TestContainerExecInspect(t *testing.T) {
... ...
@@ -10,6 +10,8 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/errdefs"
13
+	"gotest.tools/v3/assert"
14
+	is "gotest.tools/v3/assert/cmp"
13 15
 )
14 16
 
15 17
 func TestContainerExportError(t *testing.T) {
... ...
@@ -17,9 +19,7 @@ func TestContainerExportError(t *testing.T) {
17 17
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
18 18
 	}
19 19
 	_, err := client.ContainerExport(context.Background(), "nothing")
20
-	if !errdefs.IsSystem(err) {
21
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
22
-	}
20
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
23 21
 }
24 22
 
25 23
 func TestContainerExport(t *testing.T) {
... ...
@@ -13,6 +13,8 @@ import (
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/errdefs"
15 15
 	"github.com/pkg/errors"
16
+	"gotest.tools/v3/assert"
17
+	is "gotest.tools/v3/assert/cmp"
16 18
 )
17 19
 
18 20
 func TestContainerInspectError(t *testing.T) {
... ...
@@ -21,9 +23,7 @@ func TestContainerInspectError(t *testing.T) {
21 21
 	}
22 22
 
23 23
 	_, err := client.ContainerInspect(context.Background(), "nothing")
24
-	if !errdefs.IsSystem(err) {
25
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
26
-	}
24
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
27 25
 }
28 26
 
29 27
 func TestContainerInspectContainerNotFound(t *testing.T) {
... ...
@@ -32,9 +32,7 @@ func TestContainerInspectContainerNotFound(t *testing.T) {
32 32
 	}
33 33
 
34 34
 	_, err := client.ContainerInspect(context.Background(), "unknown")
35
-	if err == nil || !IsErrNotFound(err) {
36
-		t.Fatalf("expected a containerNotFound error, got %v", err)
37
-	}
35
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
38 36
 }
39 37
 
40 38
 func TestContainerInspectWithEmptyID(t *testing.T) {
... ...
@@ -44,9 +42,7 @@ func TestContainerInspectWithEmptyID(t *testing.T) {
44 44
 		}),
45 45
 	}
46 46
 	_, _, err := client.ContainerInspectWithRaw(context.Background(), "", true)
47
-	if !IsErrNotFound(err) {
48
-		t.Fatalf("Expected NotFoundError, got %v", err)
49
-	}
47
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
50 48
 }
51 49
 
52 50
 func TestContainerInspect(t *testing.T) {
... ...
@@ -10,6 +10,8 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/errdefs"
13
+	"gotest.tools/v3/assert"
14
+	is "gotest.tools/v3/assert/cmp"
13 15
 )
14 16
 
15 17
 func TestContainerKillError(t *testing.T) {
... ...
@@ -17,9 +19,7 @@ func TestContainerKillError(t *testing.T) {
17 17
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
18 18
 	}
19 19
 	err := client.ContainerKill(context.Background(), "nothing", "SIGKILL")
20
-	if !errdefs.IsSystem(err) {
21
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
22
-	}
20
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
23 21
 }
24 22
 
25 23
 func TestContainerKill(t *testing.T) {
... ...
@@ -13,6 +13,8 @@ import (
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/filters"
15 15
 	"github.com/docker/docker/errdefs"
16
+	"gotest.tools/v3/assert"
17
+	is "gotest.tools/v3/assert/cmp"
16 18
 )
17 19
 
18 20
 func TestContainerListError(t *testing.T) {
... ...
@@ -20,9 +22,7 @@ func TestContainerListError(t *testing.T) {
20 20
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
21 21
 	}
22 22
 	_, err := client.ContainerList(context.Background(), types.ContainerListOptions{})
23
-	if !errdefs.IsSystem(err) {
24
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
25
-	}
23
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
26 24
 }
27 25
 
28 26
 func TestContainerList(t *testing.T) {
... ...
@@ -23,9 +23,7 @@ func TestContainerLogsNotFoundError(t *testing.T) {
23 23
 		client: newMockClient(errorMock(http.StatusNotFound, "Not found")),
24 24
 	}
25 25
 	_, err := client.ContainerLogs(context.Background(), "container_id", types.ContainerLogsOptions{})
26
-	if !IsErrNotFound(err) {
27
-		t.Fatalf("expected a not found error, got %v", err)
28
-	}
26
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
29 27
 }
30 28
 
31 29
 func TestContainerLogsError(t *testing.T) {
... ...
@@ -33,9 +31,8 @@ func TestContainerLogsError(t *testing.T) {
33 33
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
34 34
 	}
35 35
 	_, err := client.ContainerLogs(context.Background(), "container_id", types.ContainerLogsOptions{})
36
-	if !errdefs.IsSystem(err) {
37
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
38
-	}
36
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
37
+
39 38
 	_, err = client.ContainerLogs(context.Background(), "container_id", types.ContainerLogsOptions{
40 39
 		Since: "2006-01-02TZ",
41 40
 	})
... ...
@@ -10,6 +10,8 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/errdefs"
13
+	"gotest.tools/v3/assert"
14
+	is "gotest.tools/v3/assert/cmp"
13 15
 )
14 16
 
15 17
 func TestContainerPauseError(t *testing.T) {
... ...
@@ -17,9 +19,7 @@ func TestContainerPauseError(t *testing.T) {
17 17
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
18 18
 	}
19 19
 	err := client.ContainerPause(context.Background(), "nothing")
20
-	if !errdefs.IsSystem(err) {
21
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
22
-	}
20
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
23 21
 }
24 22
 
25 23
 func TestContainerPause(t *testing.T) {
... ...
@@ -24,9 +24,7 @@ func TestContainersPruneError(t *testing.T) {
24 24
 	}
25 25
 
26 26
 	_, err := client.ContainersPrune(context.Background(), filters.Args{})
27
-	if !errdefs.IsSystem(err) {
28
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
29
-	}
27
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
30 28
 }
31 29
 
32 30
 func TestContainersPrune(t *testing.T) {
... ...
@@ -12,6 +12,7 @@ import (
12 12
 	"github.com/docker/docker/api/types"
13 13
 	"github.com/docker/docker/errdefs"
14 14
 	"gotest.tools/v3/assert"
15
+	is "gotest.tools/v3/assert/cmp"
15 16
 )
16 17
 
17 18
 func TestContainerRemoveError(t *testing.T) {
... ...
@@ -19,9 +20,7 @@ func TestContainerRemoveError(t *testing.T) {
19 19
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
20 20
 	}
21 21
 	err := client.ContainerRemove(context.Background(), "container_id", types.ContainerRemoveOptions{})
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestContainerRemoveNotFoundError(t *testing.T) {
... ...
@@ -29,8 +28,8 @@ func TestContainerRemoveNotFoundError(t *testing.T) {
29 29
 		client: newMockClient(errorMock(http.StatusNotFound, "no such container: container_id")),
30 30
 	}
31 31
 	err := client.ContainerRemove(context.Background(), "container_id", types.ContainerRemoveOptions{})
32
-	assert.ErrorContains(t, err, "no such container: container_id")
33
-	assert.Check(t, IsErrNotFound(err))
32
+	assert.Check(t, is.ErrorContains(err, "no such container: container_id"))
33
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
34 34
 }
35 35
 
36 36
 func TestContainerRemove(t *testing.T) {
... ...
@@ -10,6 +10,8 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/errdefs"
13
+	"gotest.tools/v3/assert"
14
+	is "gotest.tools/v3/assert/cmp"
13 15
 )
14 16
 
15 17
 func TestContainerRenameError(t *testing.T) {
... ...
@@ -17,9 +19,7 @@ func TestContainerRenameError(t *testing.T) {
17 17
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
18 18
 	}
19 19
 	err := client.ContainerRename(context.Background(), "nothing", "newNothing")
20
-	if !errdefs.IsSystem(err) {
21
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
22
-	}
20
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
23 21
 }
24 22
 
25 23
 func TestContainerRename(t *testing.T) {
... ...
@@ -11,6 +11,8 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/api/types"
13 13
 	"github.com/docker/docker/errdefs"
14
+	"gotest.tools/v3/assert"
15
+	is "gotest.tools/v3/assert/cmp"
14 16
 )
15 17
 
16 18
 func TestContainerResizeError(t *testing.T) {
... ...
@@ -18,9 +20,7 @@ func TestContainerResizeError(t *testing.T) {
18 18
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
19 19
 	}
20 20
 	err := client.ContainerResize(context.Background(), "container_id", types.ResizeOptions{})
21
-	if !errdefs.IsSystem(err) {
22
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
23
-	}
21
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
24 22
 }
25 23
 
26 24
 func TestContainerExecResizeError(t *testing.T) {
... ...
@@ -28,9 +28,7 @@ func TestContainerExecResizeError(t *testing.T) {
28 28
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
29 29
 	}
30 30
 	err := client.ContainerExecResize(context.Background(), "exec_id", types.ResizeOptions{})
31
-	if !errdefs.IsSystem(err) {
32
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
33
-	}
31
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
34 32
 }
35 33
 
36 34
 func TestContainerResize(t *testing.T) {
... ...
@@ -11,6 +11,8 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/api/types/container"
13 13
 	"github.com/docker/docker/errdefs"
14
+	"gotest.tools/v3/assert"
15
+	is "gotest.tools/v3/assert/cmp"
14 16
 )
15 17
 
16 18
 func TestContainerRestartError(t *testing.T) {
... ...
@@ -18,9 +20,7 @@ func TestContainerRestartError(t *testing.T) {
18 18
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
19 19
 	}
20 20
 	err := client.ContainerRestart(context.Background(), "nothing", container.StopOptions{})
21
-	if !errdefs.IsSystem(err) {
22
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
23
-	}
21
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
24 22
 }
25 23
 
26 24
 func TestContainerRestart(t *testing.T) {
... ...
@@ -12,6 +12,8 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestContainerStartError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestContainerStartError(t *testing.T) {
19 19
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
20 20
 	}
21 21
 	err := client.ContainerStart(context.Background(), "nothing", types.ContainerStartOptions{})
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestContainerStart(t *testing.T) {
... ...
@@ -10,6 +10,8 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/errdefs"
13
+	"gotest.tools/v3/assert"
14
+	is "gotest.tools/v3/assert/cmp"
13 15
 )
14 16
 
15 17
 func TestContainerStatsError(t *testing.T) {
... ...
@@ -17,9 +19,7 @@ func TestContainerStatsError(t *testing.T) {
17 17
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
18 18
 	}
19 19
 	_, err := client.ContainerStats(context.Background(), "nothing", false)
20
-	if !errdefs.IsSystem(err) {
21
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
22
-	}
20
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
23 21
 }
24 22
 
25 23
 func TestContainerStats(t *testing.T) {
... ...
@@ -11,6 +11,8 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/api/types/container"
13 13
 	"github.com/docker/docker/errdefs"
14
+	"gotest.tools/v3/assert"
15
+	is "gotest.tools/v3/assert/cmp"
14 16
 )
15 17
 
16 18
 func TestContainerStopError(t *testing.T) {
... ...
@@ -18,9 +20,7 @@ func TestContainerStopError(t *testing.T) {
18 18
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
19 19
 	}
20 20
 	err := client.ContainerStop(context.Background(), "nothing", container.StopOptions{})
21
-	if !errdefs.IsSystem(err) {
22
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
23
-	}
21
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
24 22
 }
25 23
 
26 24
 func TestContainerStop(t *testing.T) {
... ...
@@ -13,6 +13,8 @@ import (
13 13
 
14 14
 	"github.com/docker/docker/api/types/container"
15 15
 	"github.com/docker/docker/errdefs"
16
+	"gotest.tools/v3/assert"
17
+	is "gotest.tools/v3/assert/cmp"
16 18
 )
17 19
 
18 20
 func TestContainerTopError(t *testing.T) {
... ...
@@ -20,9 +22,7 @@ func TestContainerTopError(t *testing.T) {
20 20
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
21 21
 	}
22 22
 	_, err := client.ContainerTop(context.Background(), "nothing", []string{})
23
-	if !errdefs.IsSystem(err) {
24
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
25
-	}
23
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
26 24
 }
27 25
 
28 26
 func TestContainerTop(t *testing.T) {
... ...
@@ -10,6 +10,8 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/errdefs"
13
+	"gotest.tools/v3/assert"
14
+	is "gotest.tools/v3/assert/cmp"
13 15
 )
14 16
 
15 17
 func TestContainerUnpauseError(t *testing.T) {
... ...
@@ -17,9 +19,7 @@ func TestContainerUnpauseError(t *testing.T) {
17 17
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
18 18
 	}
19 19
 	err := client.ContainerUnpause(context.Background(), "nothing")
20
-	if !errdefs.IsSystem(err) {
21
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
22
-	}
20
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
23 21
 }
24 22
 
25 23
 func TestContainerUnpause(t *testing.T) {
... ...
@@ -12,6 +12,8 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types/container"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestContainerUpdateError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestContainerUpdateError(t *testing.T) {
19 19
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
20 20
 	}
21 21
 	_, err := client.ContainerUpdate(context.Background(), "nothing", container.UpdateConfig{})
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestContainerUpdate(t *testing.T) {
... ...
@@ -14,6 +14,8 @@ import (
14 14
 
15 15
 	"github.com/docker/docker/api/types/container"
16 16
 	"github.com/docker/docker/errdefs"
17
+	"gotest.tools/v3/assert"
18
+	is "gotest.tools/v3/assert/cmp"
17 19
 )
18 20
 
19 21
 func TestContainerWaitError(t *testing.T) {
... ...
@@ -25,9 +27,7 @@ func TestContainerWaitError(t *testing.T) {
25 25
 	case result := <-resultC:
26 26
 		t.Fatalf("expected to not get a wait result, got %d", result.StatusCode)
27 27
 	case err := <-errC:
28
-		if !errdefs.IsSystem(err) {
29
-			t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
30
-		}
28
+		assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
31 29
 	}
32 30
 }
33 31
 
... ...
@@ -12,6 +12,8 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestDiskUsageError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestDiskUsageError(t *testing.T) {
19 19
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
20 20
 	}
21 21
 	_, err := client.DiskUsage(context.Background(), types.DiskUsageOptions{})
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestDiskUsage(t *testing.T) {
... ...
@@ -5,6 +5,7 @@ import (
5 5
 	"net/http"
6 6
 	"testing"
7 7
 
8
+	"github.com/docker/docker/errdefs"
8 9
 	"github.com/pkg/errors"
9 10
 	"gotest.tools/v3/assert"
10 11
 	is "gotest.tools/v3/assert/cmp"
... ...
@@ -26,7 +27,5 @@ func TestDistributionInspectWithEmptyID(t *testing.T) {
26 26
 		}),
27 27
 	}
28 28
 	_, err := client.DistributionInspect(context.Background(), "", "")
29
-	if !IsErrNotFound(err) {
30
-		t.Fatalf("Expected NotFoundError, got %v", err)
31
-	}
29
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
32 30
 }
... ...
@@ -14,6 +14,8 @@ import (
14 14
 	"github.com/docker/docker/api/types/events"
15 15
 	"github.com/docker/docker/api/types/filters"
16 16
 	"github.com/docker/docker/errdefs"
17
+	"gotest.tools/v3/assert"
18
+	is "gotest.tools/v3/assert/cmp"
17 19
 )
18 20
 
19 21
 func TestEventsErrorInOptions(t *testing.T) {
... ...
@@ -52,9 +54,7 @@ func TestEventsErrorFromServer(t *testing.T) {
52 52
 	}
53 53
 	_, errs := client.Events(context.Background(), types.EventsOptions{})
54 54
 	err := <-errs
55
-	if !errdefs.IsSystem(err) {
56
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
57
-	}
55
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
58 56
 }
59 57
 
60 58
 func TestEvents(t *testing.T) {
... ...
@@ -15,6 +15,8 @@ import (
15 15
 	"github.com/docker/docker/api/types/registry"
16 16
 	"github.com/docker/docker/errdefs"
17 17
 	units "github.com/docker/go-units"
18
+	"gotest.tools/v3/assert"
19
+	is "gotest.tools/v3/assert/cmp"
18 20
 )
19 21
 
20 22
 func TestImageBuildError(t *testing.T) {
... ...
@@ -22,9 +24,7 @@ func TestImageBuildError(t *testing.T) {
22 22
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
23 23
 	}
24 24
 	_, err := client.ImageBuild(context.Background(), nil, types.ImageBuildOptions{})
25
-	if !errdefs.IsSystem(err) {
26
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
27
-	}
25
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
28 26
 }
29 27
 
30 28
 func TestImageBuild(t *testing.T) {
... ...
@@ -12,6 +12,8 @@ import (
12 12
 	"github.com/docker/docker/api/types"
13 13
 	"github.com/docker/docker/api/types/registry"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestImageCreateError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestImageCreateError(t *testing.T) {
19 19
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
20 20
 	}
21 21
 	_, err := client.ImageCreate(context.Background(), "reference", types.ImageCreateOptions{})
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestImageCreate(t *testing.T) {
... ...
@@ -12,6 +12,8 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types/image"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestImageHistoryError(t *testing.T) {
... ...
@@ -19,9 +21,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
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestImageHistory(t *testing.T) {
... ...
@@ -12,6 +12,8 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestImageImportError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestImageImportError(t *testing.T) {
19 19
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
20 20
 	}
21 21
 	_, err := client.ImageImport(context.Background(), types.ImageImportSource{}, "image:tag", types.ImageImportOptions{})
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestImageImport(t *testing.T) {
... ...
@@ -14,6 +14,8 @@ import (
14 14
 	"github.com/docker/docker/api/types"
15 15
 	"github.com/docker/docker/errdefs"
16 16
 	"github.com/pkg/errors"
17
+	"gotest.tools/v3/assert"
18
+	is "gotest.tools/v3/assert/cmp"
17 19
 )
18 20
 
19 21
 func TestImageInspectError(t *testing.T) {
... ...
@@ -22,9 +24,7 @@ func TestImageInspectError(t *testing.T) {
22 22
 	}
23 23
 
24 24
 	_, _, err := client.ImageInspectWithRaw(context.Background(), "nothing")
25
-	if !errdefs.IsSystem(err) {
26
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
27
-	}
25
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
28 26
 }
29 27
 
30 28
 func TestImageInspectImageNotFound(t *testing.T) {
... ...
@@ -33,9 +33,7 @@ func TestImageInspectImageNotFound(t *testing.T) {
33 33
 	}
34 34
 
35 35
 	_, _, err := client.ImageInspectWithRaw(context.Background(), "unknown")
36
-	if err == nil || !IsErrNotFound(err) {
37
-		t.Fatalf("expected an imageNotFound error, got %v", err)
38
-	}
36
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
39 37
 }
40 38
 
41 39
 func TestImageInspectWithEmptyID(t *testing.T) {
... ...
@@ -45,9 +43,7 @@ func TestImageInspectWithEmptyID(t *testing.T) {
45 45
 		}),
46 46
 	}
47 47
 	_, _, err := client.ImageInspectWithRaw(context.Background(), "")
48
-	if !IsErrNotFound(err) {
49
-		t.Fatalf("Expected NotFoundError, got %v", err)
50
-	}
48
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
51 49
 }
52 50
 
53 51
 func TestImageInspect(t *testing.T) {
... ...
@@ -24,9 +24,7 @@ func TestImageListError(t *testing.T) {
24 24
 	}
25 25
 
26 26
 	_, err := client.ImageList(context.Background(), types.ImageListOptions{})
27
-	if !errdefs.IsSystem(err) {
28
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
29
-	}
27
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
30 28
 }
31 29
 
32 30
 func TestImageList(t *testing.T) {
... ...
@@ -10,6 +10,8 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/errdefs"
13
+	"gotest.tools/v3/assert"
14
+	is "gotest.tools/v3/assert/cmp"
13 15
 )
14 16
 
15 17
 func TestImageLoadError(t *testing.T) {
... ...
@@ -18,9 +20,7 @@ func TestImageLoadError(t *testing.T) {
18 18
 	}
19 19
 
20 20
 	_, err := client.ImageLoad(context.Background(), nil, true)
21
-	if !errdefs.IsSystem(err) {
22
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
23
-	}
21
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
24 22
 }
25 23
 
26 24
 func TestImageLoad(t *testing.T) {
... ...
@@ -25,9 +25,7 @@ func TestImagesPruneError(t *testing.T) {
25 25
 	}
26 26
 
27 27
 	_, err := client.ImagesPrune(context.Background(), filters.NewArgs())
28
-	if !errdefs.IsSystem(err) {
29
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
30
-	}
28
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
31 29
 }
32 30
 
33 31
 func TestImagesPrune(t *testing.T) {
... ...
@@ -12,6 +12,8 @@ import (
12 12
 	"github.com/docker/docker/api/types"
13 13
 	"github.com/docker/docker/api/types/registry"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestImagePullReferenceParseError(t *testing.T) {
... ...
@@ -32,9 +34,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", types.ImagePullOptions{})
35
-	if !errdefs.IsSystem(err) {
36
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
37
-	}
35
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
38 36
 }
39 37
 
40 38
 func TestImagePullStatusUnauthorizedError(t *testing.T) {
... ...
@@ -42,9 +42,7 @@ func TestImagePullStatusUnauthorizedError(t *testing.T) {
42 42
 		client: newMockClient(errorMock(http.StatusUnauthorized, "Unauthorized error")),
43 43
 	}
44 44
 	_, err := client.ImagePull(context.Background(), "myimage", types.ImagePullOptions{})
45
-	if !errdefs.IsUnauthorized(err) {
46
-		t.Fatalf("expected a Unauthorized Error, got %[1]T: %[1]v", err)
47
-	}
45
+	assert.Check(t, is.ErrorType(err, errdefs.IsUnauthorized))
48 46
 }
49 47
 
50 48
 func TestImagePullWithUnauthorizedErrorAndPrivilegeFuncError(t *testing.T) {
... ...
@@ -72,9 +70,7 @@ func TestImagePullWithUnauthorizedErrorAndAnotherUnauthorizedError(t *testing.T)
72 72
 	_, err := client.ImagePull(context.Background(), "myimage", types.ImagePullOptions{
73 73
 		PrivilegeFunc: privilegeFunc,
74 74
 	})
75
-	if !errdefs.IsUnauthorized(err) {
76
-		t.Fatalf("expected a Unauthorized Error, got %[1]T: %[1]v", err)
77
-	}
75
+	assert.Check(t, is.ErrorType(err, errdefs.IsUnauthorized))
78 76
 }
79 77
 
80 78
 func TestImagePullWithPrivilegedFuncNoError(t *testing.T) {
... ...
@@ -12,6 +12,8 @@ import (
12 12
 	"github.com/docker/docker/api/types"
13 13
 	"github.com/docker/docker/api/types/registry"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestImagePushReferenceError(t *testing.T) {
... ...
@@ -37,9 +39,7 @@ func TestImagePushAnyError(t *testing.T) {
37 37
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
38 38
 	}
39 39
 	_, err := client.ImagePush(context.Background(), "myimage", types.ImagePushOptions{})
40
-	if !errdefs.IsSystem(err) {
41
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
42
-	}
40
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
43 41
 }
44 42
 
45 43
 func TestImagePushStatusUnauthorizedError(t *testing.T) {
... ...
@@ -47,9 +47,7 @@ func TestImagePushStatusUnauthorizedError(t *testing.T) {
47 47
 		client: newMockClient(errorMock(http.StatusUnauthorized, "Unauthorized error")),
48 48
 	}
49 49
 	_, err := client.ImagePush(context.Background(), "myimage", types.ImagePushOptions{})
50
-	if !errdefs.IsUnauthorized(err) {
51
-		t.Fatalf("expected a Unauthorized Error, got %[1]T: %[1]v", err)
52
-	}
50
+	assert.Check(t, is.ErrorType(err, errdefs.IsUnauthorized))
53 51
 }
54 52
 
55 53
 func TestImagePushWithUnauthorizedErrorAndPrivilegeFuncError(t *testing.T) {
... ...
@@ -77,9 +75,7 @@ func TestImagePushWithUnauthorizedErrorAndAnotherUnauthorizedError(t *testing.T)
77 77
 	_, err := client.ImagePush(context.Background(), "myimage", types.ImagePushOptions{
78 78
 		PrivilegeFunc: privilegeFunc,
79 79
 	})
80
-	if !errdefs.IsUnauthorized(err) {
81
-		t.Fatalf("expected a Unauthorized Error, got %[1]T: %[1]v", err)
82
-	}
80
+	assert.Check(t, is.ErrorType(err, errdefs.IsUnauthorized))
83 81
 }
84 82
 
85 83
 func TestImagePushWithPrivilegedFuncNoError(t *testing.T) {
... ...
@@ -13,6 +13,7 @@ import (
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/errdefs"
15 15
 	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
16 17
 )
17 18
 
18 19
 func TestImageRemoveError(t *testing.T) {
... ...
@@ -21,9 +22,7 @@ func TestImageRemoveError(t *testing.T) {
21 21
 	}
22 22
 
23 23
 	_, err := client.ImageRemove(context.Background(), "image_id", types.ImageRemoveOptions{})
24
-	if !errdefs.IsSystem(err) {
25
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
26
-	}
24
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
27 25
 }
28 26
 
29 27
 func TestImageRemoveImageNotFound(t *testing.T) {
... ...
@@ -32,8 +31,8 @@ func TestImageRemoveImageNotFound(t *testing.T) {
32 32
 	}
33 33
 
34 34
 	_, err := client.ImageRemove(context.Background(), "unknown", types.ImageRemoveOptions{})
35
-	assert.ErrorContains(t, err, "no such image: unknown")
36
-	assert.Check(t, IsErrNotFound(err))
35
+	assert.Check(t, is.ErrorContains(err, "no such image: unknown"))
36
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
37 37
 }
38 38
 
39 39
 func TestImageRemove(t *testing.T) {
... ...
@@ -11,6 +11,8 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/errdefs"
14
+	"gotest.tools/v3/assert"
15
+	is "gotest.tools/v3/assert/cmp"
14 16
 )
15 17
 
16 18
 func TestImageSaveError(t *testing.T) {
... ...
@@ -18,9 +20,7 @@ func TestImageSaveError(t *testing.T) {
18 18
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
19 19
 	}
20 20
 	_, err := client.ImageSave(context.Background(), []string{"nothing"})
21
-	if !errdefs.IsSystem(err) {
22
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
23
-	}
21
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
24 22
 }
25 23
 
26 24
 func TestImageSave(t *testing.T) {
... ...
@@ -14,6 +14,8 @@ import (
14 14
 	"github.com/docker/docker/api/types/filters"
15 15
 	"github.com/docker/docker/api/types/registry"
16 16
 	"github.com/docker/docker/errdefs"
17
+	"gotest.tools/v3/assert"
18
+	is "gotest.tools/v3/assert/cmp"
17 19
 )
18 20
 
19 21
 func TestImageSearchAnyError(t *testing.T) {
... ...
@@ -21,9 +23,7 @@ func TestImageSearchAnyError(t *testing.T) {
21 21
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
22 22
 	}
23 23
 	_, err := client.ImageSearch(context.Background(), "some-image", types.ImageSearchOptions{})
24
-	if !errdefs.IsSystem(err) {
25
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
26
-	}
24
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
27 25
 }
28 26
 
29 27
 func TestImageSearchStatusUnauthorizedError(t *testing.T) {
... ...
@@ -31,9 +31,7 @@ func TestImageSearchStatusUnauthorizedError(t *testing.T) {
31 31
 		client: newMockClient(errorMock(http.StatusUnauthorized, "Unauthorized error")),
32 32
 	}
33 33
 	_, err := client.ImageSearch(context.Background(), "some-image", types.ImageSearchOptions{})
34
-	if !errdefs.IsUnauthorized(err) {
35
-		t.Fatalf("expected a Unauthorized Error, got %[1]T: %[1]v", err)
36
-	}
34
+	assert.Check(t, is.ErrorType(err, errdefs.IsUnauthorized))
37 35
 }
38 36
 
39 37
 func TestImageSearchWithUnauthorizedErrorAndPrivilegeFuncError(t *testing.T) {
... ...
@@ -61,9 +59,7 @@ func TestImageSearchWithUnauthorizedErrorAndAnotherUnauthorizedError(t *testing.
61 61
 	_, err := client.ImageSearch(context.Background(), "some-image", types.ImageSearchOptions{
62 62
 		PrivilegeFunc: privilegeFunc,
63 63
 	})
64
-	if !errdefs.IsUnauthorized(err) {
65
-		t.Fatalf("expected a Unauthorized Error, got %[1]T: %[1]v", err)
66
-	}
64
+	assert.Check(t, is.ErrorType(err, errdefs.IsUnauthorized))
67 65
 }
68 66
 
69 67
 func TestImageSearchWithPrivilegedFuncNoError(t *testing.T) {
... ...
@@ -10,6 +10,8 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/errdefs"
13
+	"gotest.tools/v3/assert"
14
+	is "gotest.tools/v3/assert/cmp"
13 15
 )
14 16
 
15 17
 func TestImageTagError(t *testing.T) {
... ...
@@ -18,9 +20,7 @@ func TestImageTagError(t *testing.T) {
18 18
 	}
19 19
 
20 20
 	err := client.ImageTag(context.Background(), "image_id", "repo:tag")
21
-	if !errdefs.IsSystem(err) {
22
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
23
-	}
21
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
24 22
 }
25 23
 
26 24
 // Note: this is not testing all the InvalidReference as it's the responsibility
... ...
@@ -12,6 +12,8 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestInfoServerError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestInfoServerError(t *testing.T) {
19 19
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
20 20
 	}
21 21
 	_, err := client.Info(context.Background())
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestInfoInvalidResponseJSONError(t *testing.T) {
... ...
@@ -13,6 +13,8 @@ import (
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/network"
15 15
 	"github.com/docker/docker/errdefs"
16
+	"gotest.tools/v3/assert"
17
+	is "gotest.tools/v3/assert/cmp"
16 18
 )
17 19
 
18 20
 func TestNetworkConnectError(t *testing.T) {
... ...
@@ -21,9 +23,7 @@ func TestNetworkConnectError(t *testing.T) {
21 21
 	}
22 22
 
23 23
 	err := client.NetworkConnect(context.Background(), "network_id", "container_id", nil)
24
-	if !errdefs.IsSystem(err) {
25
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
26
-	}
24
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
27 25
 }
28 26
 
29 27
 func TestNetworkConnectEmptyNilEndpointSettings(t *testing.T) {
... ...
@@ -12,6 +12,8 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestNetworkCreateError(t *testing.T) {
... ...
@@ -20,9 +22,7 @@ func TestNetworkCreateError(t *testing.T) {
20 20
 	}
21 21
 
22 22
 	_, err := client.NetworkCreate(context.Background(), "mynetwork", types.NetworkCreate{})
23
-	if !errdefs.IsSystem(err) {
24
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
25
-	}
23
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
26 24
 }
27 25
 
28 26
 func TestNetworkCreate(t *testing.T) {
... ...
@@ -12,6 +12,8 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestNetworkDisconnectError(t *testing.T) {
... ...
@@ -20,9 +22,7 @@ func TestNetworkDisconnectError(t *testing.T) {
20 20
 	}
21 21
 
22 22
 	err := client.NetworkDisconnect(context.Background(), "network_id", "container_id", false)
23
-	if !errdefs.IsSystem(err) {
24
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
25
-	}
23
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
26 24
 }
27 25
 
28 26
 func TestNetworkDisconnect(t *testing.T) {
... ...
@@ -14,6 +14,7 @@ import (
14 14
 	"github.com/docker/docker/api/types/network"
15 15
 	"github.com/docker/docker/errdefs"
16 16
 	"gotest.tools/v3/assert"
17
+	is "gotest.tools/v3/assert/cmp"
17 18
 )
18 19
 
19 20
 func TestNetworkInspect(t *testing.T) {
... ...
@@ -69,7 +70,7 @@ func TestNetworkInspect(t *testing.T) {
69 69
 	t.Run("empty ID", func(t *testing.T) {
70 70
 		// verify that the client does not create a request if the network-ID/name is empty.
71 71
 		_, err := client.NetworkInspect(context.Background(), "", types.NetworkInspectOptions{})
72
-		assert.Check(t, IsErrNotFound(err))
72
+		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
73 73
 	})
74 74
 	t.Run("no options", func(t *testing.T) {
75 75
 		r, err := client.NetworkInspect(context.Background(), "network_id", types.NetworkInspectOptions{})
... ...
@@ -87,17 +88,17 @@ func TestNetworkInspect(t *testing.T) {
87 87
 	})
88 88
 	t.Run("global scope", func(t *testing.T) {
89 89
 		_, err := client.NetworkInspect(context.Background(), "network_id", types.NetworkInspectOptions{Scope: "global"})
90
-		assert.ErrorContains(t, err, "Error: No such network: network_id")
91
-		assert.Check(t, IsErrNotFound(err))
90
+		assert.Check(t, is.ErrorContains(err, "Error: No such network: network_id"))
91
+		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
92 92
 	})
93 93
 	t.Run("unknown network", func(t *testing.T) {
94 94
 		_, err := client.NetworkInspect(context.Background(), "unknown", types.NetworkInspectOptions{})
95
-		assert.ErrorContains(t, err, "Error: No such network: unknown")
96
-		assert.Check(t, IsErrNotFound(err))
95
+		assert.Check(t, is.ErrorContains(err, "Error: No such network: unknown"))
96
+		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
97 97
 	})
98 98
 	t.Run("server error", func(t *testing.T) {
99 99
 		// Just testing that an internal server error is converted correctly by the client
100 100
 		_, err := client.NetworkInspect(context.Background(), "test-500-response", types.NetworkInspectOptions{})
101
-		assert.Check(t, errdefs.IsSystem(err))
101
+		assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
102 102
 	})
103 103
 }
... ...
@@ -13,6 +13,8 @@ import (
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/filters"
15 15
 	"github.com/docker/docker/errdefs"
16
+	"gotest.tools/v3/assert"
17
+	is "gotest.tools/v3/assert/cmp"
16 18
 )
17 19
 
18 20
 func TestNetworkListError(t *testing.T) {
... ...
@@ -21,9 +23,7 @@ func TestNetworkListError(t *testing.T) {
21 21
 	}
22 22
 
23 23
 	_, err := client.NetworkList(context.Background(), types.NetworkListOptions{})
24
-	if !errdefs.IsSystem(err) {
25
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
26
-	}
24
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
27 25
 }
28 26
 
29 27
 func TestNetworkList(t *testing.T) {
... ...
@@ -24,9 +24,7 @@ func TestNetworksPruneError(t *testing.T) {
24 24
 	}
25 25
 
26 26
 	_, err := client.NetworksPrune(context.Background(), filters.NewArgs())
27
-	if !errdefs.IsSystem(err) {
28
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
29
-	}
27
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
30 28
 }
31 29
 
32 30
 func TestNetworksPrune(t *testing.T) {
... ...
@@ -10,6 +10,8 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/errdefs"
13
+	"gotest.tools/v3/assert"
14
+	is "gotest.tools/v3/assert/cmp"
13 15
 )
14 16
 
15 17
 func TestNetworkRemoveError(t *testing.T) {
... ...
@@ -18,9 +20,7 @@ func TestNetworkRemoveError(t *testing.T) {
18 18
 	}
19 19
 
20 20
 	err := client.NetworkRemove(context.Background(), "network_id")
21
-	if !errdefs.IsSystem(err) {
22
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
23
-	}
21
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
24 22
 }
25 23
 
26 24
 func TestNetworkRemove(t *testing.T) {
... ...
@@ -13,6 +13,8 @@ import (
13 13
 	"github.com/docker/docker/api/types/swarm"
14 14
 	"github.com/docker/docker/errdefs"
15 15
 	"github.com/pkg/errors"
16
+	"gotest.tools/v3/assert"
17
+	is "gotest.tools/v3/assert/cmp"
16 18
 )
17 19
 
18 20
 func TestNodeInspectError(t *testing.T) {
... ...
@@ -21,9 +23,7 @@ func TestNodeInspectError(t *testing.T) {
21 21
 	}
22 22
 
23 23
 	_, _, err := client.NodeInspectWithRaw(context.Background(), "nothing")
24
-	if !errdefs.IsSystem(err) {
25
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
26
-	}
24
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
27 25
 }
28 26
 
29 27
 func TestNodeInspectNodeNotFound(t *testing.T) {
... ...
@@ -32,9 +32,7 @@ func TestNodeInspectNodeNotFound(t *testing.T) {
32 32
 	}
33 33
 
34 34
 	_, _, err := client.NodeInspectWithRaw(context.Background(), "unknown")
35
-	if err == nil || !IsErrNotFound(err) {
36
-		t.Fatalf("expected a nodeNotFoundError error, got %v", err)
37
-	}
35
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
38 36
 }
39 37
 
40 38
 func TestNodeInspectWithEmptyID(t *testing.T) {
... ...
@@ -44,9 +42,7 @@ func TestNodeInspectWithEmptyID(t *testing.T) {
44 44
 		}),
45 45
 	}
46 46
 	_, _, err := client.NodeInspectWithRaw(context.Background(), "")
47
-	if !IsErrNotFound(err) {
48
-		t.Fatalf("Expected NotFoundError, got %v", err)
49
-	}
47
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
50 48
 }
51 49
 
52 50
 func TestNodeInspect(t *testing.T) {
... ...
@@ -14,6 +14,8 @@ import (
14 14
 	"github.com/docker/docker/api/types/filters"
15 15
 	"github.com/docker/docker/api/types/swarm"
16 16
 	"github.com/docker/docker/errdefs"
17
+	"gotest.tools/v3/assert"
18
+	is "gotest.tools/v3/assert/cmp"
17 19
 )
18 20
 
19 21
 func TestNodeListError(t *testing.T) {
... ...
@@ -22,9 +24,7 @@ func TestNodeListError(t *testing.T) {
22 22
 	}
23 23
 
24 24
 	_, err := client.NodeList(context.Background(), types.NodeListOptions{})
25
-	if !errdefs.IsSystem(err) {
26
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
27
-	}
25
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
28 26
 }
29 27
 
30 28
 func TestNodeList(t *testing.T) {
... ...
@@ -11,6 +11,8 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/api/types"
13 13
 	"github.com/docker/docker/errdefs"
14
+	"gotest.tools/v3/assert"
15
+	is "gotest.tools/v3/assert/cmp"
14 16
 )
15 17
 
16 18
 func TestNodeRemoveError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestNodeRemoveError(t *testing.T) {
19 19
 	}
20 20
 
21 21
 	err := client.NodeRemove(context.Background(), "node_id", types.NodeRemoveOptions{Force: false})
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestNodeRemove(t *testing.T) {
... ...
@@ -11,6 +11,8 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/api/types/swarm"
13 13
 	"github.com/docker/docker/errdefs"
14
+	"gotest.tools/v3/assert"
15
+	is "gotest.tools/v3/assert/cmp"
14 16
 )
15 17
 
16 18
 func TestNodeUpdateError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestNodeUpdateError(t *testing.T) {
19 19
 	}
20 20
 
21 21
 	err := client.NodeUpdate(context.Background(), "node_id", swarm.Version{}, swarm.NodeSpec{})
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestNodeUpdate(t *testing.T) {
... ...
@@ -34,7 +34,7 @@ func TestPingFail(t *testing.T) {
34 34
 	}
35 35
 
36 36
 	ping, err := client.Ping(context.Background())
37
-	assert.ErrorContains(t, err, "some error with the server")
37
+	assert.Check(t, is.ErrorContains(err, "some error with the server"))
38 38
 	assert.Check(t, is.Equal(false, ping.Experimental))
39 39
 	assert.Check(t, is.Equal("", ping.APIVersion))
40 40
 	var si *swarm.Status
... ...
@@ -42,7 +42,7 @@ func TestPingFail(t *testing.T) {
42 42
 
43 43
 	withHeader = true
44 44
 	ping2, err := client.Ping(context.Background())
45
-	assert.ErrorContains(t, err, "some error with the server")
45
+	assert.Check(t, is.ErrorContains(err, "some error with the server"))
46 46
 	assert.Check(t, is.Equal(true, ping2.Experimental))
47 47
 	assert.Check(t, is.Equal("awesome", ping2.APIVersion))
48 48
 	assert.Check(t, is.Equal(swarm.Status{NodeState: "inactive"}, *ping2.SwarmStatus))
... ...
@@ -64,7 +64,7 @@ func TestPingWithError(t *testing.T) {
64 64
 	}
65 65
 
66 66
 	ping, err := client.Ping(context.Background())
67
-	assert.ErrorContains(t, err, "some error")
67
+	assert.Check(t, is.ErrorContains(err, "some error"))
68 68
 	assert.Check(t, is.Equal(false, ping.Experimental))
69 69
 	assert.Check(t, is.Equal("", ping.APIVersion))
70 70
 	var si *swarm.Status
... ...
@@ -11,6 +11,8 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/api/types"
13 13
 	"github.com/docker/docker/errdefs"
14
+	"gotest.tools/v3/assert"
15
+	is "gotest.tools/v3/assert/cmp"
14 16
 )
15 17
 
16 18
 func TestPluginDisableError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestPluginDisableError(t *testing.T) {
19 19
 	}
20 20
 
21 21
 	err := client.PluginDisable(context.Background(), "plugin_name", types.PluginDisableOptions{})
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestPluginDisable(t *testing.T) {
... ...
@@ -11,6 +11,8 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/api/types"
13 13
 	"github.com/docker/docker/errdefs"
14
+	"gotest.tools/v3/assert"
15
+	is "gotest.tools/v3/assert/cmp"
14 16
 )
15 17
 
16 18
 func TestPluginEnableError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestPluginEnableError(t *testing.T) {
19 19
 	}
20 20
 
21 21
 	err := client.PluginEnable(context.Background(), "plugin_name", types.PluginEnableOptions{})
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestPluginEnable(t *testing.T) {
... ...
@@ -13,6 +13,8 @@ import (
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/errdefs"
15 15
 	"github.com/pkg/errors"
16
+	"gotest.tools/v3/assert"
17
+	is "gotest.tools/v3/assert/cmp"
16 18
 )
17 19
 
18 20
 func TestPluginInspectError(t *testing.T) {
... ...
@@ -21,9 +23,7 @@ func TestPluginInspectError(t *testing.T) {
21 21
 	}
22 22
 
23 23
 	_, _, err := client.PluginInspectWithRaw(context.Background(), "nothing")
24
-	if !errdefs.IsSystem(err) {
25
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
26
-	}
24
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
27 25
 }
28 26
 
29 27
 func TestPluginInspectWithEmptyID(t *testing.T) {
... ...
@@ -33,9 +33,7 @@ func TestPluginInspectWithEmptyID(t *testing.T) {
33 33
 		}),
34 34
 	}
35 35
 	_, _, err := client.PluginInspectWithRaw(context.Background(), "")
36
-	if !IsErrNotFound(err) {
37
-		t.Fatalf("Expected NotFoundError, got %v", err)
38
-	}
36
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
39 37
 }
40 38
 
41 39
 func TestPluginInspect(t *testing.T) {
... ...
@@ -13,6 +13,8 @@ import (
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/filters"
15 15
 	"github.com/docker/docker/errdefs"
16
+	"gotest.tools/v3/assert"
17
+	is "gotest.tools/v3/assert/cmp"
16 18
 )
17 19
 
18 20
 func TestPluginListError(t *testing.T) {
... ...
@@ -21,9 +23,7 @@ func TestPluginListError(t *testing.T) {
21 21
 	}
22 22
 
23 23
 	_, err := client.PluginList(context.Background(), filters.NewArgs())
24
-	if !errdefs.IsSystem(err) {
25
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
26
-	}
24
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
27 25
 }
28 26
 
29 27
 func TestPluginList(t *testing.T) {
... ...
@@ -11,6 +11,8 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/api/types/registry"
13 13
 	"github.com/docker/docker/errdefs"
14
+	"gotest.tools/v3/assert"
15
+	is "gotest.tools/v3/assert/cmp"
14 16
 )
15 17
 
16 18
 func TestPluginPushError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestPluginPushError(t *testing.T) {
19 19
 	}
20 20
 
21 21
 	_, err := client.PluginPush(context.Background(), "plugin_name", "")
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestPluginPush(t *testing.T) {
... ...
@@ -11,6 +11,8 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/api/types"
13 13
 	"github.com/docker/docker/errdefs"
14
+	"gotest.tools/v3/assert"
15
+	is "gotest.tools/v3/assert/cmp"
14 16
 )
15 17
 
16 18
 func TestPluginRemoveError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestPluginRemoveError(t *testing.T) {
19 19
 	}
20 20
 
21 21
 	err := client.PluginRemove(context.Background(), "plugin_name", types.PluginRemoveOptions{})
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestPluginRemove(t *testing.T) {
... ...
@@ -10,6 +10,8 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/errdefs"
13
+	"gotest.tools/v3/assert"
14
+	is "gotest.tools/v3/assert/cmp"
13 15
 )
14 16
 
15 17
 func TestPluginSetError(t *testing.T) {
... ...
@@ -18,9 +20,7 @@ func TestPluginSetError(t *testing.T) {
18 18
 	}
19 19
 
20 20
 	err := client.PluginSet(context.Background(), "plugin_name", []string{})
21
-	if !errdefs.IsSystem(err) {
22
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
23
-	}
21
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
24 22
 }
25 23
 
26 24
 func TestPluginSet(t *testing.T) {
... ...
@@ -88,9 +88,7 @@ func TestPlainTextError(t *testing.T) {
88 88
 		client: newMockClient(plainTextErrorMock(http.StatusInternalServerError, "Server error")),
89 89
 	}
90 90
 	_, err := client.ContainerList(context.Background(), types.ContainerListOptions{})
91
-	if !errdefs.IsSystem(err) {
92
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
93
-	}
91
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
94 92
 }
95 93
 
96 94
 func TestInfiniteError(t *testing.T) {
... ...
@@ -32,9 +32,7 @@ func TestSecretCreateError(t *testing.T) {
32 32
 		client:  newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
33 33
 	}
34 34
 	_, err := client.SecretCreate(context.Background(), swarm.SecretSpec{})
35
-	if !errdefs.IsSystem(err) {
36
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
37
-	}
35
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
38 36
 }
39 37
 
40 38
 func TestSecretCreate(t *testing.T) {
... ...
@@ -33,9 +33,7 @@ func TestSecretInspectError(t *testing.T) {
33 33
 	}
34 34
 
35 35
 	_, _, err := client.SecretInspectWithRaw(context.Background(), "nothing")
36
-	if !errdefs.IsSystem(err) {
37
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
38
-	}
36
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
39 37
 }
40 38
 
41 39
 func TestSecretInspectSecretNotFound(t *testing.T) {
... ...
@@ -45,9 +43,7 @@ func TestSecretInspectSecretNotFound(t *testing.T) {
45 45
 	}
46 46
 
47 47
 	_, _, err := client.SecretInspectWithRaw(context.Background(), "unknown")
48
-	if err == nil || !IsErrNotFound(err) {
49
-		t.Fatalf("expected a secretNotFoundError error, got %v", err)
50
-	}
48
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
51 49
 }
52 50
 
53 51
 func TestSecretInspectWithEmptyID(t *testing.T) {
... ...
@@ -57,9 +53,7 @@ func TestSecretInspectWithEmptyID(t *testing.T) {
57 57
 		}),
58 58
 	}
59 59
 	_, _, err := client.SecretInspectWithRaw(context.Background(), "")
60
-	if !IsErrNotFound(err) {
61
-		t.Fatalf("Expected NotFoundError, got %v", err)
62
-	}
60
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
63 61
 }
64 62
 
65 63
 func TestSecretInspect(t *testing.T) {
... ...
@@ -34,9 +34,7 @@ func TestSecretListError(t *testing.T) {
34 34
 	}
35 35
 
36 36
 	_, err := client.SecretList(context.Background(), types.SecretListOptions{})
37
-	if !errdefs.IsSystem(err) {
38
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
39
-	}
37
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
40 38
 }
41 39
 
42 40
 func TestSecretList(t *testing.T) {
... ...
@@ -30,9 +30,7 @@ func TestSecretRemoveError(t *testing.T) {
30 30
 	}
31 31
 
32 32
 	err := client.SecretRemove(context.Background(), "secret_id")
33
-	if !errdefs.IsSystem(err) {
34
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
35
-	}
33
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
36 34
 }
37 35
 
38 36
 func TestSecretRemove(t *testing.T) {
... ...
@@ -31,9 +31,7 @@ func TestSecretUpdateError(t *testing.T) {
31 31
 	}
32 32
 
33 33
 	err := client.SecretUpdate(context.Background(), "secret_id", swarm.Version{}, swarm.SecretSpec{})
34
-	if !errdefs.IsSystem(err) {
35
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
36
-	}
34
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
37 35
 }
38 36
 
39 37
 func TestSecretUpdate(t *testing.T) {
... ...
@@ -25,9 +25,7 @@ func TestServiceCreateError(t *testing.T) {
25 25
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
26 26
 	}
27 27
 	_, err := client.ServiceCreate(context.Background(), swarm.ServiceSpec{}, types.ServiceCreateOptions{})
28
-	if !errdefs.IsSystem(err) {
29
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
30
-	}
28
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
31 29
 }
32 30
 
33 31
 func TestServiceCreate(t *testing.T) {
... ...
@@ -14,6 +14,8 @@ import (
14 14
 	"github.com/docker/docker/api/types/swarm"
15 15
 	"github.com/docker/docker/errdefs"
16 16
 	"github.com/pkg/errors"
17
+	"gotest.tools/v3/assert"
18
+	is "gotest.tools/v3/assert/cmp"
17 19
 )
18 20
 
19 21
 func TestServiceInspectError(t *testing.T) {
... ...
@@ -22,9 +24,7 @@ func TestServiceInspectError(t *testing.T) {
22 22
 	}
23 23
 
24 24
 	_, _, err := client.ServiceInspectWithRaw(context.Background(), "nothing", types.ServiceInspectOptions{})
25
-	if !errdefs.IsSystem(err) {
26
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
27
-	}
25
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
28 26
 }
29 27
 
30 28
 func TestServiceInspectServiceNotFound(t *testing.T) {
... ...
@@ -33,9 +33,7 @@ func TestServiceInspectServiceNotFound(t *testing.T) {
33 33
 	}
34 34
 
35 35
 	_, _, err := client.ServiceInspectWithRaw(context.Background(), "unknown", types.ServiceInspectOptions{})
36
-	if err == nil || !IsErrNotFound(err) {
37
-		t.Fatalf("expected a serviceNotFoundError error, got %v", err)
38
-	}
36
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
39 37
 }
40 38
 
41 39
 func TestServiceInspectWithEmptyID(t *testing.T) {
... ...
@@ -45,9 +43,7 @@ func TestServiceInspectWithEmptyID(t *testing.T) {
45 45
 		}),
46 46
 	}
47 47
 	_, _, err := client.ServiceInspectWithRaw(context.Background(), "", types.ServiceInspectOptions{})
48
-	if !IsErrNotFound(err) {
49
-		t.Fatalf("Expected NotFoundError, got %v", err)
50
-	}
48
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
51 49
 }
52 50
 
53 51
 func TestServiceInspect(t *testing.T) {
... ...
@@ -14,6 +14,8 @@ import (
14 14
 	"github.com/docker/docker/api/types/filters"
15 15
 	"github.com/docker/docker/api/types/swarm"
16 16
 	"github.com/docker/docker/errdefs"
17
+	"gotest.tools/v3/assert"
18
+	is "gotest.tools/v3/assert/cmp"
17 19
 )
18 20
 
19 21
 func TestServiceListError(t *testing.T) {
... ...
@@ -22,9 +24,7 @@ func TestServiceListError(t *testing.T) {
22 22
 	}
23 23
 
24 24
 	_, err := client.ServiceList(context.Background(), types.ServiceListOptions{})
25
-	if !errdefs.IsSystem(err) {
26
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
27
-	}
25
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
28 26
 }
29 27
 
30 28
 func TestServiceList(t *testing.T) {
... ...
@@ -23,9 +23,8 @@ func TestServiceLogsError(t *testing.T) {
23 23
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
24 24
 	}
25 25
 	_, err := client.ServiceLogs(context.Background(), "service_id", types.ContainerLogsOptions{})
26
-	if !errdefs.IsSystem(err) {
27
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
28
-	}
26
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
27
+
29 28
 	_, err = client.ServiceLogs(context.Background(), "service_id", types.ContainerLogsOptions{
30 29
 		Since: "2006-01-02TZ",
31 30
 	})
... ...
@@ -11,6 +11,7 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/errdefs"
13 13
 	"gotest.tools/v3/assert"
14
+	is "gotest.tools/v3/assert/cmp"
14 15
 )
15 16
 
16 17
 func TestServiceRemoveError(t *testing.T) {
... ...
@@ -19,9 +20,7 @@ func TestServiceRemoveError(t *testing.T) {
19 19
 	}
20 20
 
21 21
 	err := client.ServiceRemove(context.Background(), "service_id")
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestServiceRemoveNotFoundError(t *testing.T) {
... ...
@@ -30,8 +29,8 @@ func TestServiceRemoveNotFoundError(t *testing.T) {
30 30
 	}
31 31
 
32 32
 	err := client.ServiceRemove(context.Background(), "service_id")
33
-	assert.ErrorContains(t, err, "no such service: service_id")
34
-	assert.Check(t, IsErrNotFound(err))
33
+	assert.Check(t, is.ErrorContains(err, "no such service: service_id"))
34
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
35 35
 }
36 36
 
37 37
 func TestServiceRemove(t *testing.T) {
... ...
@@ -12,6 +12,8 @@ import (
12 12
 	"github.com/docker/docker/api/types"
13 13
 	"github.com/docker/docker/api/types/swarm"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestServiceUpdateError(t *testing.T) {
... ...
@@ -20,9 +22,7 @@ func TestServiceUpdateError(t *testing.T) {
20 20
 	}
21 21
 
22 22
 	_, err := client.ServiceUpdate(context.Background(), "service_id", swarm.Version{}, swarm.ServiceSpec{}, types.ServiceUpdateOptions{})
23
-	if !errdefs.IsSystem(err) {
24
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
25
-	}
23
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
26 24
 }
27 25
 
28 26
 func TestServiceUpdate(t *testing.T) {
... ...
@@ -22,9 +22,7 @@ func TestSwarmGetUnlockKeyError(t *testing.T) {
22 22
 	}
23 23
 
24 24
 	_, err := client.SwarmGetUnlockKey(context.Background())
25
-	if !errdefs.IsSystem(err) {
26
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
27
-	}
25
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
28 26
 }
29 27
 
30 28
 func TestSwarmGetUnlockKey(t *testing.T) {
... ...
@@ -11,6 +11,8 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/api/types/swarm"
13 13
 	"github.com/docker/docker/errdefs"
14
+	"gotest.tools/v3/assert"
15
+	is "gotest.tools/v3/assert/cmp"
14 16
 )
15 17
 
16 18
 func TestSwarmInitError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestSwarmInitError(t *testing.T) {
19 19
 	}
20 20
 
21 21
 	_, err := client.SwarmInit(context.Background(), swarm.InitRequest{})
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestSwarmInit(t *testing.T) {
... ...
@@ -12,6 +12,8 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types/swarm"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestSwarmInspectError(t *testing.T) {
... ...
@@ -20,9 +22,7 @@ func TestSwarmInspectError(t *testing.T) {
20 20
 	}
21 21
 
22 22
 	_, err := client.SwarmInspect(context.Background())
23
-	if !errdefs.IsSystem(err) {
24
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
25
-	}
23
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
26 24
 }
27 25
 
28 26
 func TestSwarmInspect(t *testing.T) {
... ...
@@ -11,6 +11,8 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/api/types/swarm"
13 13
 	"github.com/docker/docker/errdefs"
14
+	"gotest.tools/v3/assert"
15
+	is "gotest.tools/v3/assert/cmp"
14 16
 )
15 17
 
16 18
 func TestSwarmJoinError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestSwarmJoinError(t *testing.T) {
19 19
 	}
20 20
 
21 21
 	err := client.SwarmJoin(context.Background(), swarm.JoinRequest{})
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestSwarmJoin(t *testing.T) {
... ...
@@ -10,6 +10,8 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/errdefs"
13
+	"gotest.tools/v3/assert"
14
+	is "gotest.tools/v3/assert/cmp"
13 15
 )
14 16
 
15 17
 func TestSwarmLeaveError(t *testing.T) {
... ...
@@ -18,9 +20,7 @@ func TestSwarmLeaveError(t *testing.T) {
18 18
 	}
19 19
 
20 20
 	err := client.SwarmLeave(context.Background(), false)
21
-	if !errdefs.IsSystem(err) {
22
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
23
-	}
21
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
24 22
 }
25 23
 
26 24
 func TestSwarmLeave(t *testing.T) {
... ...
@@ -11,6 +11,8 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/api/types/swarm"
13 13
 	"github.com/docker/docker/errdefs"
14
+	"gotest.tools/v3/assert"
15
+	is "gotest.tools/v3/assert/cmp"
14 16
 )
15 17
 
16 18
 func TestSwarmUnlockError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestSwarmUnlockError(t *testing.T) {
19 19
 	}
20 20
 
21 21
 	err := client.SwarmUnlock(context.Background(), swarm.UnlockRequest{UnlockKey: "SWMKEY-1-y6guTZNTwpQeTL5RhUfOsdBdXoQjiB2GADHSRJvbXeU"})
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestSwarmUnlock(t *testing.T) {
... ...
@@ -11,6 +11,8 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/api/types/swarm"
13 13
 	"github.com/docker/docker/errdefs"
14
+	"gotest.tools/v3/assert"
15
+	is "gotest.tools/v3/assert/cmp"
14 16
 )
15 17
 
16 18
 func TestSwarmUpdateError(t *testing.T) {
... ...
@@ -19,9 +21,7 @@ func TestSwarmUpdateError(t *testing.T) {
19 19
 	}
20 20
 
21 21
 	err := client.SwarmUpdate(context.Background(), swarm.Version{}, swarm.Spec{}, swarm.UpdateFlags{})
22
-	if !errdefs.IsSystem(err) {
23
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
24
-	}
22
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
25 23
 }
26 24
 
27 25
 func TestSwarmUpdate(t *testing.T) {
... ...
@@ -13,6 +13,8 @@ import (
13 13
 	"github.com/docker/docker/api/types/swarm"
14 14
 	"github.com/docker/docker/errdefs"
15 15
 	"github.com/pkg/errors"
16
+	"gotest.tools/v3/assert"
17
+	is "gotest.tools/v3/assert/cmp"
16 18
 )
17 19
 
18 20
 func TestTaskInspectError(t *testing.T) {
... ...
@@ -21,9 +23,7 @@ func TestTaskInspectError(t *testing.T) {
21 21
 	}
22 22
 
23 23
 	_, _, err := client.TaskInspectWithRaw(context.Background(), "nothing")
24
-	if !errdefs.IsSystem(err) {
25
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
26
-	}
24
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
27 25
 }
28 26
 
29 27
 func TestTaskInspectWithEmptyID(t *testing.T) {
... ...
@@ -33,9 +33,7 @@ func TestTaskInspectWithEmptyID(t *testing.T) {
33 33
 		}),
34 34
 	}
35 35
 	_, _, err := client.TaskInspectWithRaw(context.Background(), "")
36
-	if !IsErrNotFound(err) {
37
-		t.Fatalf("Expected NotFoundError, got %v", err)
38
-	}
36
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
39 37
 }
40 38
 
41 39
 func TestTaskInspect(t *testing.T) {
... ...
@@ -14,6 +14,8 @@ import (
14 14
 	"github.com/docker/docker/api/types/filters"
15 15
 	"github.com/docker/docker/api/types/swarm"
16 16
 	"github.com/docker/docker/errdefs"
17
+	"gotest.tools/v3/assert"
18
+	is "gotest.tools/v3/assert/cmp"
17 19
 )
18 20
 
19 21
 func TestTaskListError(t *testing.T) {
... ...
@@ -22,9 +24,7 @@ func TestTaskListError(t *testing.T) {
22 22
 	}
23 23
 
24 24
 	_, err := client.TaskList(context.Background(), types.TaskListOptions{})
25
-	if !errdefs.IsSystem(err) {
26
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
27
-	}
25
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
28 26
 }
29 27
 
30 28
 func TestTaskList(t *testing.T) {
... ...
@@ -12,6 +12,8 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types/volume"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestVolumeCreateError(t *testing.T) {
... ...
@@ -20,9 +22,7 @@ func TestVolumeCreateError(t *testing.T) {
20 20
 	}
21 21
 
22 22
 	_, err := client.VolumeCreate(context.Background(), volume.CreateOptions{})
23
-	if !errdefs.IsSystem(err) {
24
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
25
-	}
23
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
26 24
 }
27 25
 
28 26
 func TestVolumeCreate(t *testing.T) {
... ...
@@ -23,9 +23,7 @@ func TestVolumeInspectError(t *testing.T) {
23 23
 	}
24 24
 
25 25
 	_, err := client.VolumeInspect(context.Background(), "nothing")
26
-	if !errdefs.IsSystem(err) {
27
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
28
-	}
26
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
29 27
 }
30 28
 
31 29
 func TestVolumeInspectNotFound(t *testing.T) {
... ...
@@ -34,7 +32,7 @@ func TestVolumeInspectNotFound(t *testing.T) {
34 34
 	}
35 35
 
36 36
 	_, err := client.VolumeInspect(context.Background(), "unknown")
37
-	assert.Check(t, IsErrNotFound(err))
37
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
38 38
 }
39 39
 
40 40
 func TestVolumeInspectWithEmptyID(t *testing.T) {
... ...
@@ -44,9 +42,7 @@ func TestVolumeInspectWithEmptyID(t *testing.T) {
44 44
 		}),
45 45
 	}
46 46
 	_, _, err := client.VolumeInspectWithRaw(context.Background(), "")
47
-	if !IsErrNotFound(err) {
48
-		t.Fatalf("Expected NotFoundError, got %v", err)
49
-	}
47
+	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
50 48
 }
51 49
 
52 50
 func TestVolumeInspect(t *testing.T) {
... ...
@@ -13,6 +13,8 @@ import (
13 13
 	"github.com/docker/docker/api/types/filters"
14 14
 	"github.com/docker/docker/api/types/volume"
15 15
 	"github.com/docker/docker/errdefs"
16
+	"gotest.tools/v3/assert"
17
+	is "gotest.tools/v3/assert/cmp"
16 18
 )
17 19
 
18 20
 func TestVolumeListError(t *testing.T) {
... ...
@@ -21,9 +23,7 @@ func TestVolumeListError(t *testing.T) {
21 21
 	}
22 22
 
23 23
 	_, err := client.VolumeList(context.Background(), volume.ListOptions{})
24
-	if !errdefs.IsSystem(err) {
25
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
26
-	}
24
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
27 25
 }
28 26
 
29 27
 func TestVolumeList(t *testing.T) {
... ...
@@ -10,6 +10,8 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/errdefs"
13
+	"gotest.tools/v3/assert"
14
+	is "gotest.tools/v3/assert/cmp"
13 15
 )
14 16
 
15 17
 func TestVolumeRemoveError(t *testing.T) {
... ...
@@ -18,9 +20,7 @@ func TestVolumeRemoveError(t *testing.T) {
18 18
 	}
19 19
 
20 20
 	err := client.VolumeRemove(context.Background(), "volume_id", false)
21
-	if !errdefs.IsSystem(err) {
22
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
23
-	}
21
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
24 22
 }
25 23
 
26 24
 func TestVolumeRemove(t *testing.T) {
... ...
@@ -12,6 +12,8 @@ import (
12 12
 	"github.com/docker/docker/api/types/swarm"
13 13
 	volumetypes "github.com/docker/docker/api/types/volume"
14 14
 	"github.com/docker/docker/errdefs"
15
+	"gotest.tools/v3/assert"
16
+	is "gotest.tools/v3/assert/cmp"
15 17
 )
16 18
 
17 19
 func TestVolumeUpdateError(t *testing.T) {
... ...
@@ -20,10 +22,7 @@ func TestVolumeUpdateError(t *testing.T) {
20 20
 	}
21 21
 
22 22
 	err := client.VolumeUpdate(context.Background(), "", swarm.Version{}, volumetypes.UpdateOptions{})
23
-
24
-	if !errdefs.IsSystem(err) {
25
-		t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
26
-	}
23
+	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
27 24
 }
28 25
 
29 26
 func TestVolumeUpdate(t *testing.T) {