Browse code

Update tests to check returned errors

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2019/01/01 02:22:43
Showing 81 changed files
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14
+	"github.com/docker/docker/errdefs"
14 15
 )
15 16
 
16 17
 func TestCheckpointCreateError(t *testing.T) {
... ...
@@ -25,6 +26,9 @@ func TestCheckpointCreateError(t *testing.T) {
25 25
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
26 26
 		t.Fatalf("expected a Server Error, got %v", err)
27 27
 	}
28
+	if !errdefs.IsSystem(err) {
29
+		t.Fatalf("expected a Server Error, got %T", err)
30
+	}
28 31
 }
29 32
 
30 33
 func TestCheckpointCreate(t *testing.T) {
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/api/types"
13
+	"github.com/docker/docker/errdefs"
13 14
 )
14 15
 
15 16
 func TestCheckpointDeleteError(t *testing.T) {
... ...
@@ -24,6 +25,9 @@ func TestCheckpointDeleteError(t *testing.T) {
24 24
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
25 25
 		t.Fatalf("expected a Server Error, got %v", err)
26 26
 	}
27
+	if !errdefs.IsSystem(err) {
28
+		t.Fatalf("expected a Server Error, got %T", err)
29
+	}
27 30
 }
28 31
 
29 32
 func TestCheckpointDelete(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14
+	"github.com/docker/docker/errdefs"
14 15
 )
15 16
 
16 17
 func TestCheckpointListError(t *testing.T) {
... ...
@@ -22,6 +23,9 @@ func TestCheckpointListError(t *testing.T) {
22 22
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
23 23
 		t.Fatalf("expected a Server Error, got %v", err)
24 24
 	}
25
+	if !errdefs.IsSystem(err) {
26
+		t.Fatalf("expected a Server Error, got %T", err)
27
+	}
25 28
 }
26 29
 
27 30
 func TestCheckpointList(t *testing.T) {
... ...
@@ -12,6 +12,7 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/swarm"
15
+	"github.com/docker/docker/errdefs"
15 16
 	"gotest.tools/assert"
16 17
 	is "gotest.tools/assert/cmp"
17 18
 )
... ...
@@ -34,6 +35,9 @@ func TestConfigCreateError(t *testing.T) {
34 34
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
35 35
 		t.Fatalf("expected a Server Error, got %v", err)
36 36
 	}
37
+	if !errdefs.IsSystem(err) {
38
+		t.Fatalf("expected a Server Error, got %T", err)
39
+	}
37 40
 }
38 41
 
39 42
 func TestConfigCreate(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types/swarm"
14
+	"github.com/docker/docker/errdefs"
14 15
 	"github.com/pkg/errors"
15 16
 	"gotest.tools/assert"
16 17
 	is "gotest.tools/assert/cmp"
... ...
@@ -58,6 +59,9 @@ func TestConfigInspectError(t *testing.T) {
58 58
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
59 59
 		t.Fatalf("expected a Server Error, got %v", err)
60 60
 	}
61
+	if !errdefs.IsSystem(err) {
62
+		t.Fatalf("expected a Server Error, got %T", err)
63
+	}
61 64
 }
62 65
 
63 66
 func TestConfigInspectConfigNotFound(t *testing.T) {
... ...
@@ -13,6 +13,7 @@ import (
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/filters"
15 15
 	"github.com/docker/docker/api/types/swarm"
16
+	"github.com/docker/docker/errdefs"
16 17
 	"gotest.tools/assert"
17 18
 	is "gotest.tools/assert/cmp"
18 19
 )
... ...
@@ -36,6 +37,9 @@ func TestConfigListError(t *testing.T) {
36 36
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
37 37
 		t.Fatalf("expected a Server Error, got %v", err)
38 38
 	}
39
+	if !errdefs.IsSystem(err) {
40
+		t.Fatalf("expected a Server Error, got %T", err)
41
+	}
39 42
 }
40 43
 
41 44
 func TestConfigList(t *testing.T) {
... ...
@@ -9,6 +9,7 @@ import (
9 9
 	"strings"
10 10
 	"testing"
11 11
 
12
+	"github.com/docker/docker/errdefs"
12 13
 	"gotest.tools/assert"
13 14
 	is "gotest.tools/assert/cmp"
14 15
 )
... ...
@@ -32,6 +33,9 @@ func TestConfigRemoveError(t *testing.T) {
32 32
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
33 33
 		t.Fatalf("expected a Server Error, got %v", err)
34 34
 	}
35
+	if !errdefs.IsSystem(err) {
36
+		t.Fatalf("expected a Server Error, got %T", err)
37
+	}
35 38
 }
36 39
 
37 40
 func TestConfigRemove(t *testing.T) {
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/api/types/swarm"
13
+	"github.com/docker/docker/errdefs"
13 14
 	"gotest.tools/assert"
14 15
 	is "gotest.tools/assert/cmp"
15 16
 )
... ...
@@ -33,6 +34,9 @@ func TestConfigUpdateError(t *testing.T) {
33 33
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
34 34
 		t.Fatalf("expected a Server Error, got %v", err)
35 35
 	}
36
+	if !errdefs.IsSystem(err) {
37
+		t.Fatalf("expected a Server Error, got %T", err)
38
+	}
36 39
 }
37 40
 
38 41
 func TestConfigUpdate(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14
+	"github.com/docker/docker/errdefs"
14 15
 )
15 16
 
16 17
 func TestContainerCommitError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestContainerCommitError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server Error, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
24 27
 }
25 28
 
26 29
 func TestContainerCommit(t *testing.T) {
... ...
@@ -12,6 +12,7 @@ import (
12 12
 	"testing"
13 13
 
14 14
 	"github.com/docker/docker/api/types"
15
+	"github.com/docker/docker/errdefs"
15 16
 )
16 17
 
17 18
 func TestContainerStatPathError(t *testing.T) {
... ...
@@ -22,6 +23,9 @@ func TestContainerStatPathError(t *testing.T) {
22 22
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
23 23
 		t.Fatalf("expected a Server error, got %v", err)
24 24
 	}
25
+	if !errdefs.IsSystem(err) {
26
+		t.Fatalf("expected a Server Error, got %T", err)
27
+	}
25 28
 }
26 29
 
27 30
 func TestContainerStatPathNotFoundError(t *testing.T) {
... ...
@@ -102,6 +106,9 @@ func TestCopyToContainerError(t *testing.T) {
102 102
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
103 103
 		t.Fatalf("expected a Server error, got %v", err)
104 104
 	}
105
+	if !errdefs.IsSystem(err) {
106
+		t.Fatalf("expected a Server Error, got %T", err)
107
+	}
105 108
 }
106 109
 
107 110
 func TestCopyToContainerNotFoundError(t *testing.T) {
... ...
@@ -178,6 +185,9 @@ func TestCopyFromContainerError(t *testing.T) {
178 178
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
179 179
 		t.Fatalf("expected a Server error, got %v", err)
180 180
 	}
181
+	if !errdefs.IsSystem(err) {
182
+		t.Fatalf("expected a Server Error, got %T", err)
183
+	}
181 184
 }
182 185
 
183 186
 func TestCopyFromContainerNotFoundError(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types/container"
14
+	"github.com/docker/docker/errdefs"
14 15
 )
15 16
 
16 17
 func TestContainerCreateError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestContainerCreateError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server Error while testing StatusInternalServerError, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error while testing StatusInternalServerError, got %T", err)
26
+	}
24 27
 
25 28
 	// 404 doesn't automatically means an unknown image
26 29
 	client = &Client{
... ...
@@ -30,6 +34,9 @@ func TestContainerCreateError(t *testing.T) {
30 30
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
31 31
 		t.Fatalf("expected a Server Error while testing StatusNotFound, got %v", err)
32 32
 	}
33
+	if err == nil || !IsErrNotFound(err) {
34
+		t.Fatalf("expected a Server Error while testing StatusNotFound, got %T", err)
35
+	}
33 36
 }
34 37
 
35 38
 func TestContainerCreateImageNotFound(t *testing.T) {
... ...
@@ -38,7 +45,7 @@ func TestContainerCreateImageNotFound(t *testing.T) {
38 38
 	}
39 39
 	_, err := client.ContainerCreate(context.Background(), &container.Config{Image: "unknown_image"}, nil, nil, "unknown")
40 40
 	if err == nil || !IsErrNotFound(err) {
41
-		t.Fatalf("expected an imageNotFound error, got %v", err)
41
+		t.Fatalf("expected an imageNotFound error, got %v, %T", err, err)
42 42
 	}
43 43
 }
44 44
 
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types/container"
14
+	"github.com/docker/docker/errdefs"
14 15
 )
15 16
 
16 17
 func TestContainerDiffError(t *testing.T) {
... ...
@@ -21,7 +22,9 @@ func TestContainerDiffError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server Error, got %v", err)
23 23
 	}
24
-
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
25 27
 }
26 28
 
27 29
 func TestContainerDiff(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14
+	"github.com/docker/docker/errdefs"
14 15
 )
15 16
 
16 17
 func TestContainerExecCreateError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestContainerExecCreateError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server Error, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
24 27
 }
25 28
 
26 29
 func TestContainerExecCreate(t *testing.T) {
... ...
@@ -76,6 +80,9 @@ func TestContainerExecStartError(t *testing.T) {
76 76
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
77 77
 		t.Fatalf("expected a Server Error, got %v", err)
78 78
 	}
79
+	if !errdefs.IsSystem(err) {
80
+		t.Fatalf("expected a Server Error, got %T", err)
81
+	}
79 82
 }
80 83
 
81 84
 func TestContainerExecStart(t *testing.T) {
... ...
@@ -120,6 +127,9 @@ func TestContainerExecInspectError(t *testing.T) {
120 120
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
121 121
 		t.Fatalf("expected a Server Error, got %v", err)
122 122
 	}
123
+	if !errdefs.IsSystem(err) {
124
+		t.Fatalf("expected a Server Error, got %T", err)
125
+	}
123 126
 }
124 127
 
125 128
 func TestContainerExecInspect(t *testing.T) {
... ...
@@ -8,6 +8,8 @@ import (
8 8
 	"net/http"
9 9
 	"strings"
10 10
 	"testing"
11
+
12
+	"github.com/docker/docker/errdefs"
11 13
 )
12 14
 
13 15
 func TestContainerExportError(t *testing.T) {
... ...
@@ -18,6 +20,9 @@ func TestContainerExportError(t *testing.T) {
18 18
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
19 19
 		t.Fatalf("expected a Server Error, got %v", err)
20 20
 	}
21
+	if !errdefs.IsSystem(err) {
22
+		t.Fatalf("expected a Server Error, got %T", err)
23
+	}
21 24
 }
22 25
 
23 26
 func TestContainerExport(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14
+	"github.com/docker/docker/errdefs"
14 15
 	"github.com/pkg/errors"
15 16
 )
16 17
 
... ...
@@ -23,6 +24,9 @@ func TestContainerInspectError(t *testing.T) {
23 23
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
24 24
 		t.Fatalf("expected a Server Error, got %v", err)
25 25
 	}
26
+	if !errdefs.IsSystem(err) {
27
+		t.Fatalf("expected a Server Error, got %T", err)
28
+	}
26 29
 }
27 30
 
28 31
 func TestContainerInspectContainerNotFound(t *testing.T) {
... ...
@@ -8,6 +8,8 @@ import (
8 8
 	"net/http"
9 9
 	"strings"
10 10
 	"testing"
11
+
12
+	"github.com/docker/docker/errdefs"
11 13
 )
12 14
 
13 15
 func TestContainerKillError(t *testing.T) {
... ...
@@ -18,6 +20,9 @@ func TestContainerKillError(t *testing.T) {
18 18
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
19 19
 		t.Fatalf("expected a Server Error, got %v", err)
20 20
 	}
21
+	if !errdefs.IsSystem(err) {
22
+		t.Fatalf("expected a Server Error, got %T", err)
23
+	}
21 24
 }
22 25
 
23 26
 func TestContainerKill(t *testing.T) {
... ...
@@ -12,6 +12,7 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/filters"
15
+	"github.com/docker/docker/errdefs"
15 16
 )
16 17
 
17 18
 func TestContainerListError(t *testing.T) {
... ...
@@ -22,6 +23,9 @@ func TestContainerListError(t *testing.T) {
22 22
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
23 23
 		t.Fatalf("expected a Server Error, got %v", err)
24 24
 	}
25
+	if !errdefs.IsSystem(err) {
26
+		t.Fatalf("expected a Server Error, got %T", err)
27
+	}
25 28
 }
26 29
 
27 30
 func TestContainerList(t *testing.T) {
... ...
@@ -8,6 +8,8 @@ import (
8 8
 	"net/http"
9 9
 	"strings"
10 10
 	"testing"
11
+
12
+	"github.com/docker/docker/errdefs"
11 13
 )
12 14
 
13 15
 func TestContainerPauseError(t *testing.T) {
... ...
@@ -18,6 +20,9 @@ func TestContainerPauseError(t *testing.T) {
18 18
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
19 19
 		t.Fatalf("expected a Server Error, got %v", err)
20 20
 	}
21
+	if !errdefs.IsSystem(err) {
22
+		t.Fatalf("expected a Server Error, got %T", err)
23
+	}
21 24
 }
22 25
 
23 26
 func TestContainerPause(t *testing.T) {
... ...
@@ -8,6 +8,8 @@ import (
8 8
 	"net/http"
9 9
 	"strings"
10 10
 	"testing"
11
+
12
+	"github.com/docker/docker/errdefs"
11 13
 )
12 14
 
13 15
 func TestContainerRenameError(t *testing.T) {
... ...
@@ -18,6 +20,9 @@ func TestContainerRenameError(t *testing.T) {
18 18
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
19 19
 		t.Fatalf("expected a Server Error, got %v", err)
20 20
 	}
21
+	if !errdefs.IsSystem(err) {
22
+		t.Fatalf("expected a Server Error, got %T", err)
23
+	}
21 24
 }
22 25
 
23 26
 func TestContainerRename(t *testing.T) {
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/api/types"
13
+	"github.com/docker/docker/errdefs"
13 14
 )
14 15
 
15 16
 func TestContainerResizeError(t *testing.T) {
... ...
@@ -20,6 +21,9 @@ func TestContainerResizeError(t *testing.T) {
20 20
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
21 21
 		t.Fatalf("expected a Server Error, got %v", err)
22 22
 	}
23
+	if !errdefs.IsSystem(err) {
24
+		t.Fatalf("expected a Server Error, got %T", err)
25
+	}
23 26
 }
24 27
 
25 28
 func TestContainerExecResizeError(t *testing.T) {
... ...
@@ -30,6 +34,9 @@ func TestContainerExecResizeError(t *testing.T) {
30 30
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
31 31
 		t.Fatalf("expected a Server Error, got %v", err)
32 32
 	}
33
+	if !errdefs.IsSystem(err) {
34
+		t.Fatalf("expected a Server Error, got %T", err)
35
+	}
33 36
 }
34 37
 
35 38
 func TestContainerResize(t *testing.T) {
... ...
@@ -9,6 +9,8 @@ import (
9 9
 	"strings"
10 10
 	"testing"
11 11
 	"time"
12
+
13
+	"github.com/docker/docker/errdefs"
12 14
 )
13 15
 
14 16
 func TestContainerRestartError(t *testing.T) {
... ...
@@ -20,6 +22,9 @@ func TestContainerRestartError(t *testing.T) {
20 20
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
21 21
 		t.Fatalf("expected a Server Error, got %v", err)
22 22
 	}
23
+	if !errdefs.IsSystem(err) {
24
+		t.Fatalf("expected a Server Error, got %T", err)
25
+	}
23 26
 }
24 27
 
25 28
 func TestContainerRestart(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14
+	"github.com/docker/docker/errdefs"
14 15
 )
15 16
 
16 17
 func TestContainerStartError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestContainerStartError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server Error, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
24 27
 }
25 28
 
26 29
 func TestContainerStart(t *testing.T) {
... ...
@@ -8,6 +8,8 @@ import (
8 8
 	"net/http"
9 9
 	"strings"
10 10
 	"testing"
11
+
12
+	"github.com/docker/docker/errdefs"
11 13
 )
12 14
 
13 15
 func TestContainerStatsError(t *testing.T) {
... ...
@@ -18,6 +20,9 @@ func TestContainerStatsError(t *testing.T) {
18 18
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
19 19
 		t.Fatalf("expected a Server Error, got %v", err)
20 20
 	}
21
+	if !errdefs.IsSystem(err) {
22
+		t.Fatalf("expected a Server Error, got %T", err)
23
+	}
21 24
 }
22 25
 
23 26
 func TestContainerStats(t *testing.T) {
... ...
@@ -9,6 +9,8 @@ import (
9 9
 	"strings"
10 10
 	"testing"
11 11
 	"time"
12
+
13
+	"github.com/docker/docker/errdefs"
12 14
 )
13 15
 
14 16
 func TestContainerStopError(t *testing.T) {
... ...
@@ -20,6 +22,9 @@ func TestContainerStopError(t *testing.T) {
20 20
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
21 21
 		t.Fatalf("expected a Server Error, got %v", err)
22 22
 	}
23
+	if !errdefs.IsSystem(err) {
24
+		t.Fatalf("expected a Server Error, got %T", err)
25
+	}
23 26
 }
24 27
 
25 28
 func TestContainerStop(t *testing.T) {
... ...
@@ -12,6 +12,7 @@ import (
12 12
 	"testing"
13 13
 
14 14
 	"github.com/docker/docker/api/types/container"
15
+	"github.com/docker/docker/errdefs"
15 16
 )
16 17
 
17 18
 func TestContainerTopError(t *testing.T) {
... ...
@@ -22,6 +23,9 @@ func TestContainerTopError(t *testing.T) {
22 22
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
23 23
 		t.Fatalf("expected a Server Error, got %v", err)
24 24
 	}
25
+	if !errdefs.IsSystem(err) {
26
+		t.Fatalf("expected a Server Error, got %T", err)
27
+	}
25 28
 }
26 29
 
27 30
 func TestContainerTop(t *testing.T) {
... ...
@@ -8,6 +8,8 @@ import (
8 8
 	"net/http"
9 9
 	"strings"
10 10
 	"testing"
11
+
12
+	"github.com/docker/docker/errdefs"
11 13
 )
12 14
 
13 15
 func TestContainerUnpauseError(t *testing.T) {
... ...
@@ -18,6 +20,9 @@ func TestContainerUnpauseError(t *testing.T) {
18 18
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
19 19
 		t.Fatalf("expected a Server Error, got %v", err)
20 20
 	}
21
+	if !errdefs.IsSystem(err) {
22
+		t.Fatalf("expected a Server Error, got %T", err)
23
+	}
21 24
 }
22 25
 
23 26
 func TestContainerUnpause(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types/container"
14
+	"github.com/docker/docker/errdefs"
14 15
 )
15 16
 
16 17
 func TestContainerUpdateError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestContainerUpdateError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server Error, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
24 27
 }
25 28
 
26 29
 func TestContainerUpdate(t *testing.T) {
... ...
@@ -13,6 +13,7 @@ import (
13 13
 	"time"
14 14
 
15 15
 	"github.com/docker/docker/api/types/container"
16
+	"github.com/docker/docker/errdefs"
16 17
 )
17 18
 
18 19
 func TestContainerWaitError(t *testing.T) {
... ...
@@ -27,6 +28,9 @@ func TestContainerWaitError(t *testing.T) {
27 27
 		if err.Error() != "Error response from daemon: Server error" {
28 28
 			t.Fatalf("expected a Server Error, got %v", err)
29 29
 		}
30
+		if !errdefs.IsSystem(err) {
31
+			t.Fatalf("expected a Server Error, got %T", err)
32
+		}
30 33
 	}
31 34
 }
32 35
 
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14
+	"github.com/docker/docker/errdefs"
14 15
 )
15 16
 
16 17
 func TestDiskUsageError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestDiskUsageError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server Error, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
24 27
 }
25 28
 
26 29
 func TestDiskUsage(t *testing.T) {
... ...
@@ -14,6 +14,7 @@ import (
14 14
 	"github.com/docker/docker/api/types"
15 15
 	"github.com/docker/docker/api/types/events"
16 16
 	"github.com/docker/docker/api/types/filters"
17
+	"github.com/docker/docker/errdefs"
17 18
 )
18 19
 
19 20
 func TestEventsErrorInOptions(t *testing.T) {
... ...
@@ -55,6 +56,9 @@ func TestEventsErrorFromServer(t *testing.T) {
55 55
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
56 56
 		t.Fatalf("expected a Server Error, got %v", err)
57 57
 	}
58
+	if !errdefs.IsSystem(err) {
59
+		t.Fatalf("expected a Server Error, got %T", err)
60
+	}
58 61
 }
59 62
 
60 63
 func TestEvents(t *testing.T) {
... ...
@@ -12,6 +12,7 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/container"
15
+	"github.com/docker/docker/errdefs"
15 16
 	"github.com/docker/go-units"
16 17
 )
17 18
 
... ...
@@ -23,6 +24,9 @@ func TestImageBuildError(t *testing.T) {
23 23
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
24 24
 		t.Fatalf("expected a Server Error, got %v", err)
25 25
 	}
26
+	if !errdefs.IsSystem(err) {
27
+		t.Fatalf("expected a Server Error, got %T", err)
28
+	}
26 29
 }
27 30
 
28 31
 func TestImageBuild(t *testing.T) {
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/api/types"
13
+	"github.com/docker/docker/errdefs"
13 14
 )
14 15
 
15 16
 func TestImageCreateError(t *testing.T) {
... ...
@@ -20,6 +21,9 @@ func TestImageCreateError(t *testing.T) {
20 20
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
21 21
 		t.Fatalf("expected a Server error, got %v", err)
22 22
 	}
23
+	if !errdefs.IsSystem(err) {
24
+		t.Fatalf("expected a Server Error, got %T", err)
25
+	}
23 26
 }
24 27
 
25 28
 func TestImageCreate(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types/image"
14
+	"github.com/docker/docker/errdefs"
14 15
 )
15 16
 
16 17
 func TestImageHistoryError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestImageHistoryError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server error, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
24 27
 }
25 28
 
26 29
 func TestImageHistory(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14
+	"github.com/docker/docker/errdefs"
14 15
 )
15 16
 
16 17
 func TestImageImportError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestImageImportError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server error, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
24 27
 }
25 28
 
26 29
 func TestImageImport(t *testing.T) {
... ...
@@ -12,6 +12,7 @@ import (
12 12
 	"testing"
13 13
 
14 14
 	"github.com/docker/docker/api/types"
15
+	"github.com/docker/docker/errdefs"
15 16
 	"github.com/pkg/errors"
16 17
 )
17 18
 
... ...
@@ -24,6 +25,9 @@ func TestImageInspectError(t *testing.T) {
24 24
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
25 25
 		t.Fatalf("expected a Server Error, got %v", err)
26 26
 	}
27
+	if !errdefs.IsSystem(err) {
28
+		t.Fatalf("expected a Server Error, got %T", err)
29
+	}
27 30
 }
28 31
 
29 32
 func TestImageInspectImageNotFound(t *testing.T) {
... ...
@@ -12,6 +12,7 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/filters"
15
+	"github.com/docker/docker/errdefs"
15 16
 )
16 17
 
17 18
 func TestImageListError(t *testing.T) {
... ...
@@ -23,6 +24,9 @@ func TestImageListError(t *testing.T) {
23 23
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
24 24
 		t.Fatalf("expected a Server Error, got %v", err)
25 25
 	}
26
+	if !errdefs.IsSystem(err) {
27
+		t.Fatalf("expected a Server Error, got %T", err)
28
+	}
26 29
 }
27 30
 
28 31
 func TestImageList(t *testing.T) {
... ...
@@ -8,6 +8,8 @@ import (
8 8
 	"net/http"
9 9
 	"strings"
10 10
 	"testing"
11
+
12
+	"github.com/docker/docker/errdefs"
11 13
 )
12 14
 
13 15
 func TestImageLoadError(t *testing.T) {
... ...
@@ -19,6 +21,9 @@ func TestImageLoadError(t *testing.T) {
19 19
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
20 20
 		t.Fatalf("expected a Server Error, got %v", err)
21 21
 	}
22
+	if !errdefs.IsSystem(err) {
23
+		t.Fatalf("expected a Server Error, got %T", err)
24
+	}
22 25
 }
23 26
 
24 27
 func TestImageLoad(t *testing.T) {
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/api/types"
13
+	"github.com/docker/docker/errdefs"
13 14
 )
14 15
 
15 16
 func TestImagePullReferenceParseError(t *testing.T) {
... ...
@@ -33,6 +34,9 @@ func TestImagePullAnyError(t *testing.T) {
33 33
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
34 34
 		t.Fatalf("expected a Server Error, got %v", err)
35 35
 	}
36
+	if !errdefs.IsSystem(err) {
37
+		t.Fatalf("expected a Server Error, got %T", err)
38
+	}
36 39
 }
37 40
 
38 41
 func TestImagePullStatusUnauthorizedError(t *testing.T) {
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/api/types"
13
+	"github.com/docker/docker/errdefs"
13 14
 )
14 15
 
15 16
 func TestImagePushReferenceError(t *testing.T) {
... ...
@@ -38,6 +39,9 @@ func TestImagePushAnyError(t *testing.T) {
38 38
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
39 39
 		t.Fatalf("expected a Server Error, got %v", err)
40 40
 	}
41
+	if !errdefs.IsSystem(err) {
42
+		t.Fatalf("expected a Server Error, got %T", err)
43
+	}
41 44
 }
42 45
 
43 46
 func TestImagePushStatusUnauthorizedError(t *testing.T) {
... ...
@@ -9,6 +9,8 @@ import (
9 9
 	"reflect"
10 10
 	"strings"
11 11
 	"testing"
12
+
13
+	"github.com/docker/docker/errdefs"
12 14
 )
13 15
 
14 16
 func TestImageSaveError(t *testing.T) {
... ...
@@ -19,6 +21,9 @@ func TestImageSaveError(t *testing.T) {
19 19
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
20 20
 		t.Fatalf("expected a Server error, got %v", err)
21 21
 	}
22
+	if !errdefs.IsSystem(err) {
23
+		t.Fatalf("expected a Server Error, got %T", err)
24
+	}
22 25
 }
23 26
 
24 27
 func TestImageSave(t *testing.T) {
... ...
@@ -13,6 +13,7 @@ import (
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/filters"
15 15
 	"github.com/docker/docker/api/types/registry"
16
+	"github.com/docker/docker/errdefs"
16 17
 )
17 18
 
18 19
 func TestImageSearchAnyError(t *testing.T) {
... ...
@@ -23,6 +24,9 @@ func TestImageSearchAnyError(t *testing.T) {
23 23
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
24 24
 		t.Fatalf("expected a Server Error, got %v", err)
25 25
 	}
26
+	if !errdefs.IsSystem(err) {
27
+		t.Fatalf("expected a Server Error, got %T", err)
28
+	}
26 29
 }
27 30
 
28 31
 func TestImageSearchStatusUnauthorizedError(t *testing.T) {
... ...
@@ -8,6 +8,8 @@ import (
8 8
 	"net/http"
9 9
 	"strings"
10 10
 	"testing"
11
+
12
+	"github.com/docker/docker/errdefs"
11 13
 )
12 14
 
13 15
 func TestImageTagError(t *testing.T) {
... ...
@@ -19,6 +21,9 @@ func TestImageTagError(t *testing.T) {
19 19
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
20 20
 		t.Fatalf("expected a Server Error, got %v", err)
21 21
 	}
22
+	if !errdefs.IsSystem(err) {
23
+		t.Fatalf("expected a Server Error, got %T", err)
24
+	}
22 25
 }
23 26
 
24 27
 // Note: this is not testing all the InvalidReference as it's the responsibility
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14
+	"github.com/docker/docker/errdefs"
14 15
 )
15 16
 
16 17
 func TestInfoServerError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestInfoServerError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server Error, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
24 27
 }
25 28
 
26 29
 func TestInfoInvalidResponseJSONError(t *testing.T) {
... ...
@@ -12,6 +12,7 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/network"
15
+	"github.com/docker/docker/errdefs"
15 16
 )
16 17
 
17 18
 func TestNetworkConnectError(t *testing.T) {
... ...
@@ -23,6 +24,9 @@ func TestNetworkConnectError(t *testing.T) {
23 23
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
24 24
 		t.Fatalf("expected a Server Error, got %v", err)
25 25
 	}
26
+	if !errdefs.IsSystem(err) {
27
+		t.Fatalf("expected a Server Error, got %T", err)
28
+	}
26 29
 }
27 30
 
28 31
 func TestNetworkConnectEmptyNilEndpointSettings(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14
+	"github.com/docker/docker/errdefs"
14 15
 )
15 16
 
16 17
 func TestNetworkCreateError(t *testing.T) {
... ...
@@ -22,6 +23,9 @@ func TestNetworkCreateError(t *testing.T) {
22 22
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
23 23
 		t.Fatalf("expected a Server Error, got %v", err)
24 24
 	}
25
+	if !errdefs.IsSystem(err) {
26
+		t.Fatalf("expected a Server Error, got %T", err)
27
+	}
25 28
 }
26 29
 
27 30
 func TestNetworkCreate(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14
+	"github.com/docker/docker/errdefs"
14 15
 )
15 16
 
16 17
 func TestNetworkDisconnectError(t *testing.T) {
... ...
@@ -22,6 +23,9 @@ func TestNetworkDisconnectError(t *testing.T) {
22 22
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
23 23
 		t.Fatalf("expected a Server Error, got %v", err)
24 24
 	}
25
+	if !errdefs.IsSystem(err) {
26
+		t.Fatalf("expected a Server Error, got %T", err)
27
+	}
25 28
 }
26 29
 
27 30
 func TestNetworkDisconnect(t *testing.T) {
... ...
@@ -12,6 +12,7 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/filters"
15
+	"github.com/docker/docker/errdefs"
15 16
 )
16 17
 
17 18
 func TestNetworkListError(t *testing.T) {
... ...
@@ -25,6 +26,9 @@ func TestNetworkListError(t *testing.T) {
25 25
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
26 26
 		t.Fatalf("expected a Server Error, got %v", err)
27 27
 	}
28
+	if !errdefs.IsSystem(err) {
29
+		t.Fatalf("expected a Server Error, got %T", err)
30
+	}
28 31
 }
29 32
 
30 33
 func TestNetworkList(t *testing.T) {
... ...
@@ -12,6 +12,7 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/filters"
15
+	"github.com/docker/docker/errdefs"
15 16
 	"gotest.tools/assert"
16 17
 	is "gotest.tools/assert/cmp"
17 18
 )
... ...
@@ -28,6 +29,9 @@ func TestNetworksPruneError(t *testing.T) {
28 28
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
29 29
 		t.Fatalf("expected a Server Error, got %v", err)
30 30
 	}
31
+	if !errdefs.IsSystem(err) {
32
+		t.Fatalf("expected a Server Error, got %T", err)
33
+	}
31 34
 }
32 35
 
33 36
 func TestNetworksPrune(t *testing.T) {
... ...
@@ -8,6 +8,8 @@ import (
8 8
 	"net/http"
9 9
 	"strings"
10 10
 	"testing"
11
+
12
+	"github.com/docker/docker/errdefs"
11 13
 )
12 14
 
13 15
 func TestNetworkRemoveError(t *testing.T) {
... ...
@@ -19,6 +21,9 @@ func TestNetworkRemoveError(t *testing.T) {
19 19
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
20 20
 		t.Fatalf("expected a Server Error, got %v", err)
21 21
 	}
22
+	if !errdefs.IsSystem(err) {
23
+		t.Fatalf("expected a Server Error, got %T", err)
24
+	}
22 25
 }
23 26
 
24 27
 func TestNetworkRemove(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types/swarm"
14
+	"github.com/docker/docker/errdefs"
14 15
 	"github.com/pkg/errors"
15 16
 )
16 17
 
... ...
@@ -23,6 +24,9 @@ func TestNodeInspectError(t *testing.T) {
23 23
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
24 24
 		t.Fatalf("expected a Server Error, got %v", err)
25 25
 	}
26
+	if !errdefs.IsSystem(err) {
27
+		t.Fatalf("expected a Server Error, got %T", err)
28
+	}
26 29
 }
27 30
 
28 31
 func TestNodeInspectNodeNotFound(t *testing.T) {
... ...
@@ -13,6 +13,7 @@ import (
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/filters"
15 15
 	"github.com/docker/docker/api/types/swarm"
16
+	"github.com/docker/docker/errdefs"
16 17
 )
17 18
 
18 19
 func TestNodeListError(t *testing.T) {
... ...
@@ -24,6 +25,9 @@ func TestNodeListError(t *testing.T) {
24 24
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
25 25
 		t.Fatalf("expected a Server Error, got %v", err)
26 26
 	}
27
+	if !errdefs.IsSystem(err) {
28
+		t.Fatalf("expected a Server Error, got %T", err)
29
+	}
27 30
 }
28 31
 
29 32
 func TestNodeList(t *testing.T) {
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/api/types"
13
+	"github.com/docker/docker/errdefs"
13 14
 )
14 15
 
15 16
 func TestNodeRemoveError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestNodeRemoveError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server Error, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
24 27
 }
25 28
 
26 29
 func TestNodeRemove(t *testing.T) {
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/api/types/swarm"
13
+	"github.com/docker/docker/errdefs"
13 14
 )
14 15
 
15 16
 func TestNodeUpdateError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestNodeUpdateError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server Error, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
24 27
 }
25 28
 
26 29
 func TestNodeUpdate(t *testing.T) {
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/api/types"
13
+	"github.com/docker/docker/errdefs"
13 14
 )
14 15
 
15 16
 func TestPluginDisableError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestPluginDisableError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server Error, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
24 27
 }
25 28
 
26 29
 func TestPluginDisable(t *testing.T) {
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/api/types"
13
+	"github.com/docker/docker/errdefs"
13 14
 )
14 15
 
15 16
 func TestPluginEnableError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestPluginEnableError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server Error, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
24 27
 }
25 28
 
26 29
 func TestPluginEnable(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14
+	"github.com/docker/docker/errdefs"
14 15
 	"github.com/pkg/errors"
15 16
 )
16 17
 
... ...
@@ -23,6 +24,9 @@ func TestPluginInspectError(t *testing.T) {
23 23
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
24 24
 		t.Fatalf("expected a Server Error, got %v", err)
25 25
 	}
26
+	if !errdefs.IsSystem(err) {
27
+		t.Fatalf("expected a Server Error, got %T", err)
28
+	}
26 29
 }
27 30
 
28 31
 func TestPluginInspectWithEmptyID(t *testing.T) {
... ...
@@ -12,6 +12,7 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/filters"
15
+	"github.com/docker/docker/errdefs"
15 16
 )
16 17
 
17 18
 func TestPluginListError(t *testing.T) {
... ...
@@ -23,6 +24,9 @@ func TestPluginListError(t *testing.T) {
23 23
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
24 24
 		t.Fatalf("expected a Server Error, got %v", err)
25 25
 	}
26
+	if !errdefs.IsSystem(err) {
27
+		t.Fatalf("expected a Server Error, got %T", err)
28
+	}
26 29
 }
27 30
 
28 31
 func TestPluginList(t *testing.T) {
... ...
@@ -8,6 +8,8 @@ import (
8 8
 	"net/http"
9 9
 	"strings"
10 10
 	"testing"
11
+
12
+	"github.com/docker/docker/errdefs"
11 13
 )
12 14
 
13 15
 func TestPluginPushError(t *testing.T) {
... ...
@@ -19,6 +21,9 @@ func TestPluginPushError(t *testing.T) {
19 19
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
20 20
 		t.Fatalf("expected a Server Error, got %v", err)
21 21
 	}
22
+	if !errdefs.IsSystem(err) {
23
+		t.Fatalf("expected a Server Error, got %T", err)
24
+	}
22 25
 }
23 26
 
24 27
 func TestPluginPush(t *testing.T) {
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/api/types"
13
+	"github.com/docker/docker/errdefs"
13 14
 )
14 15
 
15 16
 func TestPluginRemoveError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestPluginRemoveError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server Error, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
24 27
 }
25 28
 
26 29
 func TestPluginRemove(t *testing.T) {
... ...
@@ -8,6 +8,8 @@ import (
8 8
 	"net/http"
9 9
 	"strings"
10 10
 	"testing"
11
+
12
+	"github.com/docker/docker/errdefs"
11 13
 )
12 14
 
13 15
 func TestPluginSetError(t *testing.T) {
... ...
@@ -19,6 +21,9 @@ func TestPluginSetError(t *testing.T) {
19 19
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
20 20
 		t.Fatalf("expected a Server Error, got %v", err)
21 21
 	}
22
+	if !errdefs.IsSystem(err) {
23
+		t.Fatalf("expected a Server Error, got %T", err)
24
+	}
22 25
 }
23 26
 
24 27
 func TestPluginSet(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14
+	"github.com/docker/docker/errdefs"
14 15
 	"gotest.tools/assert"
15 16
 	is "gotest.tools/assert/cmp"
16 17
 )
... ...
@@ -88,6 +89,9 @@ func TestPlainTextError(t *testing.T) {
88 88
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
89 89
 		t.Fatalf("expected a Server Error, got %v", err)
90 90
 	}
91
+	if !errdefs.IsSystem(err) {
92
+		t.Fatalf("expected a Server Error, got %T", err)
93
+	}
91 94
 }
92 95
 
93 96
 func TestInfiniteError(t *testing.T) {
... ...
@@ -12,6 +12,7 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/swarm"
15
+	"github.com/docker/docker/errdefs"
15 16
 	"gotest.tools/assert"
16 17
 	is "gotest.tools/assert/cmp"
17 18
 )
... ...
@@ -34,6 +35,9 @@ func TestSecretCreateError(t *testing.T) {
34 34
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
35 35
 		t.Fatalf("expected a Server Error, got %v", err)
36 36
 	}
37
+	if !errdefs.IsSystem(err) {
38
+		t.Fatalf("expected a Server Error, got %T", err)
39
+	}
37 40
 }
38 41
 
39 42
 func TestSecretCreate(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types/swarm"
14
+	"github.com/docker/docker/errdefs"
14 15
 	"github.com/pkg/errors"
15 16
 	"gotest.tools/assert"
16 17
 	is "gotest.tools/assert/cmp"
... ...
@@ -35,6 +36,9 @@ func TestSecretInspectError(t *testing.T) {
35 35
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
36 36
 		t.Fatalf("expected a Server Error, got %v", err)
37 37
 	}
38
+	if !errdefs.IsSystem(err) {
39
+		t.Fatalf("expected a Server Error, got %T", err)
40
+	}
38 41
 }
39 42
 
40 43
 func TestSecretInspectSecretNotFound(t *testing.T) {
... ...
@@ -13,6 +13,7 @@ import (
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/filters"
15 15
 	"github.com/docker/docker/api/types/swarm"
16
+	"github.com/docker/docker/errdefs"
16 17
 	"gotest.tools/assert"
17 18
 	is "gotest.tools/assert/cmp"
18 19
 )
... ...
@@ -36,6 +37,9 @@ func TestSecretListError(t *testing.T) {
36 36
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
37 37
 		t.Fatalf("expected a Server Error, got %v", err)
38 38
 	}
39
+	if !errdefs.IsSystem(err) {
40
+		t.Fatalf("expected a Server Error, got %T", err)
41
+	}
39 42
 }
40 43
 
41 44
 func TestSecretList(t *testing.T) {
... ...
@@ -9,6 +9,7 @@ import (
9 9
 	"strings"
10 10
 	"testing"
11 11
 
12
+	"github.com/docker/docker/errdefs"
12 13
 	"gotest.tools/assert"
13 14
 	is "gotest.tools/assert/cmp"
14 15
 )
... ...
@@ -32,6 +33,9 @@ func TestSecretRemoveError(t *testing.T) {
32 32
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
33 33
 		t.Fatalf("expected a Server Error, got %v", err)
34 34
 	}
35
+	if !errdefs.IsSystem(err) {
36
+		t.Fatalf("expected a Server Error, got %T", err)
37
+	}
35 38
 }
36 39
 
37 40
 func TestSecretRemove(t *testing.T) {
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/api/types/swarm"
13
+	"github.com/docker/docker/errdefs"
13 14
 	"gotest.tools/assert"
14 15
 	is "gotest.tools/assert/cmp"
15 16
 )
... ...
@@ -33,6 +34,9 @@ func TestSecretUpdateError(t *testing.T) {
33 33
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
34 34
 		t.Fatalf("expected a Server Error, got %v", err)
35 35
 	}
36
+	if !errdefs.IsSystem(err) {
37
+		t.Fatalf("expected a Server Error, got %T", err)
38
+	}
36 39
 }
37 40
 
38 41
 func TestSecretUpdate(t *testing.T) {
... ...
@@ -13,6 +13,7 @@ import (
13 13
 	"github.com/docker/docker/api/types"
14 14
 	registrytypes "github.com/docker/docker/api/types/registry"
15 15
 	"github.com/docker/docker/api/types/swarm"
16
+	"github.com/docker/docker/errdefs"
16 17
 	"github.com/opencontainers/go-digest"
17 18
 	"github.com/opencontainers/image-spec/specs-go/v1"
18 19
 	"gotest.tools/assert"
... ...
@@ -27,6 +28,9 @@ func TestServiceCreateError(t *testing.T) {
27 27
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
28 28
 		t.Fatalf("expected a Server Error, got %v", err)
29 29
 	}
30
+	if !errdefs.IsSystem(err) {
31
+		t.Fatalf("expected a Server Error, got %T", err)
32
+	}
30 33
 }
31 34
 
32 35
 func TestServiceCreate(t *testing.T) {
... ...
@@ -12,6 +12,7 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/swarm"
15
+	"github.com/docker/docker/errdefs"
15 16
 	"github.com/pkg/errors"
16 17
 )
17 18
 
... ...
@@ -24,6 +25,9 @@ func TestServiceInspectError(t *testing.T) {
24 24
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
25 25
 		t.Fatalf("expected a Server Error, got %v", err)
26 26
 	}
27
+	if !errdefs.IsSystem(err) {
28
+		t.Fatalf("expected a Server Error, got %T", err)
29
+	}
27 30
 }
28 31
 
29 32
 func TestServiceInspectServiceNotFound(t *testing.T) {
... ...
@@ -13,6 +13,7 @@ import (
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/filters"
15 15
 	"github.com/docker/docker/api/types/swarm"
16
+	"github.com/docker/docker/errdefs"
16 17
 )
17 18
 
18 19
 func TestServiceListError(t *testing.T) {
... ...
@@ -24,6 +25,9 @@ func TestServiceListError(t *testing.T) {
24 24
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
25 25
 		t.Fatalf("expected a Server Error, got %v", err)
26 26
 	}
27
+	if !errdefs.IsSystem(err) {
28
+		t.Fatalf("expected a Server Error, got %T", err)
29
+	}
27 30
 }
28 31
 
29 32
 func TestServiceList(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/api/types"
13 13
 	"github.com/docker/docker/api/types/swarm"
14
+	"github.com/docker/docker/errdefs"
14 15
 )
15 16
 
16 17
 func TestServiceUpdateError(t *testing.T) {
... ...
@@ -22,6 +23,9 @@ func TestServiceUpdateError(t *testing.T) {
22 22
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
23 23
 		t.Fatalf("expected a Server Error, got %v", err)
24 24
 	}
25
+	if !errdefs.IsSystem(err) {
26
+		t.Fatalf("expected a Server Error, got %T", err)
27
+	}
25 28
 }
26 29
 
27 30
 func TestServiceUpdate(t *testing.T) {
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/api/types/swarm"
13
+	"github.com/docker/docker/errdefs"
13 14
 )
14 15
 
15 16
 func TestSwarmInitError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestSwarmInitError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server Error, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
24 27
 }
25 28
 
26 29
 func TestSwarmInit(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types/swarm"
14
+	"github.com/docker/docker/errdefs"
14 15
 )
15 16
 
16 17
 func TestSwarmInspectError(t *testing.T) {
... ...
@@ -22,6 +23,9 @@ func TestSwarmInspectError(t *testing.T) {
22 22
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
23 23
 		t.Fatalf("expected a Server Error, got %v", err)
24 24
 	}
25
+	if !errdefs.IsSystem(err) {
26
+		t.Fatalf("expected a Server Error, got %T", err)
27
+	}
25 28
 }
26 29
 
27 30
 func TestSwarmInspect(t *testing.T) {
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/api/types/swarm"
13
+	"github.com/docker/docker/errdefs"
13 14
 )
14 15
 
15 16
 func TestSwarmJoinError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestSwarmJoinError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server Error, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
24 27
 }
25 28
 
26 29
 func TestSwarmJoin(t *testing.T) {
... ...
@@ -8,6 +8,8 @@ import (
8 8
 	"net/http"
9 9
 	"strings"
10 10
 	"testing"
11
+
12
+	"github.com/docker/docker/errdefs"
11 13
 )
12 14
 
13 15
 func TestSwarmLeaveError(t *testing.T) {
... ...
@@ -19,6 +21,9 @@ func TestSwarmLeaveError(t *testing.T) {
19 19
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
20 20
 		t.Fatalf("expected a Server Error, got %v", err)
21 21
 	}
22
+	if !errdefs.IsSystem(err) {
23
+		t.Fatalf("expected a Server Error, got %T", err)
24
+	}
22 25
 }
23 26
 
24 27
 func TestSwarmLeave(t *testing.T) {
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/api/types/swarm"
13
+	"github.com/docker/docker/errdefs"
13 14
 )
14 15
 
15 16
 func TestSwarmUnlockError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestSwarmUnlockError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server Error, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
24 27
 }
25 28
 
26 29
 func TestSwarmUnlock(t *testing.T) {
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"testing"
11 11
 
12 12
 	"github.com/docker/docker/api/types/swarm"
13
+	"github.com/docker/docker/errdefs"
13 14
 )
14 15
 
15 16
 func TestSwarmUpdateError(t *testing.T) {
... ...
@@ -21,6 +22,9 @@ func TestSwarmUpdateError(t *testing.T) {
21 21
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
22 22
 		t.Fatalf("expected a Server Error, got %v", err)
23 23
 	}
24
+	if !errdefs.IsSystem(err) {
25
+		t.Fatalf("expected a Server Error, got %T", err)
26
+	}
24 27
 }
25 28
 
26 29
 func TestSwarmUpdate(t *testing.T) {
... ...
@@ -11,6 +11,7 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	"github.com/docker/docker/api/types/swarm"
14
+	"github.com/docker/docker/errdefs"
14 15
 	"github.com/pkg/errors"
15 16
 )
16 17
 
... ...
@@ -23,6 +24,9 @@ func TestTaskInspectError(t *testing.T) {
23 23
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
24 24
 		t.Fatalf("expected a Server Error, got %v", err)
25 25
 	}
26
+	if !errdefs.IsSystem(err) {
27
+		t.Fatalf("expected a Server Error, got %T", err)
28
+	}
26 29
 }
27 30
 
28 31
 func TestTaskInspectWithEmptyID(t *testing.T) {
... ...
@@ -13,6 +13,7 @@ import (
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/filters"
15 15
 	"github.com/docker/docker/api/types/swarm"
16
+	"github.com/docker/docker/errdefs"
16 17
 )
17 18
 
18 19
 func TestTaskListError(t *testing.T) {
... ...
@@ -24,6 +25,9 @@ func TestTaskListError(t *testing.T) {
24 24
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
25 25
 		t.Fatalf("expected a Server Error, got %v", err)
26 26
 	}
27
+	if !errdefs.IsSystem(err) {
28
+		t.Fatalf("expected a Server Error, got %T", err)
29
+	}
27 30
 }
28 31
 
29 32
 func TestTaskList(t *testing.T) {
... ...
@@ -12,6 +12,7 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/api/types"
14 14
 	volumetypes "github.com/docker/docker/api/types/volume"
15
+	"github.com/docker/docker/errdefs"
15 16
 )
16 17
 
17 18
 func TestVolumeCreateError(t *testing.T) {
... ...
@@ -23,6 +24,9 @@ func TestVolumeCreateError(t *testing.T) {
23 23
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
24 24
 		t.Fatalf("expected a Server Error, got %v", err)
25 25
 	}
26
+	if !errdefs.IsSystem(err) {
27
+		t.Fatalf("expected a Server Error, got %T", err)
28
+	}
26 29
 }
27 30
 
28 31
 func TestVolumeCreate(t *testing.T) {
... ...
@@ -13,6 +13,7 @@ import (
13 13
 	"github.com/docker/docker/api/types"
14 14
 	"github.com/docker/docker/api/types/filters"
15 15
 	volumetypes "github.com/docker/docker/api/types/volume"
16
+	"github.com/docker/docker/errdefs"
16 17
 )
17 18
 
18 19
 func TestVolumeListError(t *testing.T) {
... ...
@@ -24,6 +25,9 @@ func TestVolumeListError(t *testing.T) {
24 24
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
25 25
 		t.Fatalf("expected a Server Error, got %v", err)
26 26
 	}
27
+	if !errdefs.IsSystem(err) {
28
+		t.Fatalf("expected a Server Error, got %T", err)
29
+	}
27 30
 }
28 31
 
29 32
 func TestVolumeList(t *testing.T) {
... ...
@@ -8,6 +8,8 @@ import (
8 8
 	"net/http"
9 9
 	"strings"
10 10
 	"testing"
11
+
12
+	"github.com/docker/docker/errdefs"
11 13
 )
12 14
 
13 15
 func TestVolumeRemoveError(t *testing.T) {
... ...
@@ -19,6 +21,9 @@ func TestVolumeRemoveError(t *testing.T) {
19 19
 	if err == nil || err.Error() != "Error response from daemon: Server error" {
20 20
 		t.Fatalf("expected a Server Error, got %v", err)
21 21
 	}
22
+	if !errdefs.IsSystem(err) {
23
+		t.Fatalf("expected a Server Error, got %T", err)
24
+	}
22 25
 }
23 26
 
24 27
 func TestVolumeRemove(t *testing.T) {