Browse code

Merge pull request #35069 from thaJeztah/remove-deprecated-error-check

Remove deprecated error checks

Yong Tang authored on 2017/10/03 22:40:47
Showing 9 changed files
... ...
@@ -62,7 +62,7 @@ func TestCheckpointListContainerNotFound(t *testing.T) {
62 62
 	}
63 63
 
64 64
 	_, err := client.CheckpointList(context.Background(), "unknown", types.CheckpointListOptions{})
65
-	if err == nil || !IsErrContainerNotFound(err) {
65
+	if err == nil || !IsErrNotFound(err) {
66 66
 		t.Fatalf("expected a containerNotFound error, got %v", err)
67 67
 	}
68 68
 }
... ...
@@ -42,7 +42,7 @@ func TestConfigInspectConfigNotFound(t *testing.T) {
42 42
 	}
43 43
 
44 44
 	_, _, err := client.ConfigInspectWithRaw(context.Background(), "unknown")
45
-	if err == nil || !IsErrConfigNotFound(err) {
45
+	if err == nil || !IsErrNotFound(err) {
46 46
 		t.Fatalf("expected a configNotFoundError error, got %v", err)
47 47
 	}
48 48
 }
... ...
@@ -53,7 +53,7 @@ func TestConfigInspect(t *testing.T) {
53 53
 		version: "1.30",
54 54
 		client: newMockClient(func(req *http.Request) (*http.Response, error) {
55 55
 			if !strings.HasPrefix(req.URL.Path, expectedURL) {
56
-				return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL)
56
+				return nil, fmt.Errorf("expected URL '%s', got '%s'", expectedURL, req.URL)
57 57
 			}
58 58
 			content, err := json.Marshal(swarm.Config{
59 59
 				ID: "config_id",
... ...
@@ -37,7 +37,7 @@ func TestContainerCreateImageNotFound(t *testing.T) {
37 37
 		client: newMockClient(errorMock(http.StatusNotFound, "No such image")),
38 38
 	}
39 39
 	_, err := client.ContainerCreate(context.Background(), &container.Config{Image: "unknown_image"}, nil, nil, "unknown")
40
-	if err == nil || !IsErrImageNotFound(err) {
40
+	if err == nil || !IsErrNotFound(err) {
41 41
 		t.Fatalf("expected an imageNotFound error, got %v", err)
42 42
 	}
43 43
 }
... ...
@@ -30,7 +30,7 @@ func TestContainerInspectContainerNotFound(t *testing.T) {
30 30
 	}
31 31
 
32 32
 	_, err := client.ContainerInspect(context.Background(), "unknown")
33
-	if err == nil || !IsErrContainerNotFound(err) {
33
+	if err == nil || !IsErrNotFound(err) {
34 34
 		t.Fatalf("expected a containerNotFound error, got %v", err)
35 35
 	}
36 36
 }
... ...
@@ -71,38 +71,6 @@ func wrapResponseError(err error, resp serverResponse, object, id string) error
71 71
 	}
72 72
 }
73 73
 
74
-// IsErrImageNotFound returns true if the error is caused
75
-// when an image is not found in the docker host.
76
-//
77
-// Deprecated: Use IsErrNotFound
78
-func IsErrImageNotFound(err error) bool {
79
-	return IsErrNotFound(err)
80
-}
81
-
82
-// IsErrContainerNotFound returns true if the error is caused
83
-// when a container is not found in the docker host.
84
-//
85
-// Deprecated: Use IsErrNotFound
86
-func IsErrContainerNotFound(err error) bool {
87
-	return IsErrNotFound(err)
88
-}
89
-
90
-// IsErrNetworkNotFound returns true if the error is caused
91
-// when a network is not found in the docker host.
92
-//
93
-// Deprecated: Use IsErrNotFound
94
-func IsErrNetworkNotFound(err error) bool {
95
-	return IsErrNotFound(err)
96
-}
97
-
98
-// IsErrVolumeNotFound returns true if the error is caused
99
-// when a volume is not found in the docker host.
100
-//
101
-// Deprecated: Use IsErrNotFound
102
-func IsErrVolumeNotFound(err error) bool {
103
-	return IsErrNotFound(err)
104
-}
105
-
106 74
 // unauthorizedError represents an authorization error in a remote registry.
107 75
 type unauthorizedError struct {
108 76
 	cause error
... ...
@@ -120,30 +88,6 @@ func IsErrUnauthorized(err error) bool {
120 120
 	return ok
121 121
 }
122 122
 
123
-// IsErrNodeNotFound returns true if the error is caused
124
-// when a node is not found.
125
-//
126
-// Deprecated: Use IsErrNotFound
127
-func IsErrNodeNotFound(err error) bool {
128
-	return IsErrNotFound(err)
129
-}
130
-
131
-// IsErrServiceNotFound returns true if the error is caused
132
-// when a service is not found.
133
-//
134
-// Deprecated: Use IsErrNotFound
135
-func IsErrServiceNotFound(err error) bool {
136
-	return IsErrNotFound(err)
137
-}
138
-
139
-// IsErrTaskNotFound returns true if the error is caused
140
-// when a task is not found.
141
-//
142
-// Deprecated: Use IsErrNotFound
143
-func IsErrTaskNotFound(err error) bool {
144
-	return IsErrNotFound(err)
145
-}
146
-
147 123
 type pluginPermissionDenied struct {
148 124
 	name string
149 125
 }
... ...
@@ -187,27 +131,3 @@ func (cli *Client) NewVersionError(APIrequired, feature string) error {
187 187
 	}
188 188
 	return nil
189 189
 }
190
-
191
-// IsErrSecretNotFound returns true if the error is caused
192
-// when a secret is not found.
193
-//
194
-// Deprecated: Use IsErrNotFound
195
-func IsErrSecretNotFound(err error) bool {
196
-	return IsErrNotFound(err)
197
-}
198
-
199
-// IsErrConfigNotFound returns true if the error is caused
200
-// when a config is not found.
201
-//
202
-// Deprecated: Use IsErrNotFound
203
-func IsErrConfigNotFound(err error) bool {
204
-	return IsErrNotFound(err)
205
-}
206
-
207
-// IsErrPluginNotFound returns true if the error is caused
208
-// when a plugin is not found in the docker host.
209
-//
210
-// Deprecated: Use IsErrNotFound
211
-func IsErrPluginNotFound(err error) bool {
212
-	return IsErrNotFound(err)
213
-}
... ...
@@ -31,7 +31,7 @@ func TestImageInspectImageNotFound(t *testing.T) {
31 31
 	}
32 32
 
33 33
 	_, _, err := client.ImageInspectWithRaw(context.Background(), "unknown")
34
-	if err == nil || !IsErrImageNotFound(err) {
34
+	if err == nil || !IsErrNotFound(err) {
35 35
 		t.Fatalf("expected an imageNotFound error, got %v", err)
36 36
 	}
37 37
 }
... ...
@@ -30,7 +30,7 @@ func TestNodeInspectNodeNotFound(t *testing.T) {
30 30
 	}
31 31
 
32 32
 	_, _, err := client.NodeInspectWithRaw(context.Background(), "unknown")
33
-	if err == nil || !IsErrNodeNotFound(err) {
33
+	if err == nil || !IsErrNotFound(err) {
34 34
 		t.Fatalf("expected a nodeNotFoundError error, got %v", err)
35 35
 	}
36 36
 }
... ...
@@ -42,7 +42,7 @@ func TestSecretInspectSecretNotFound(t *testing.T) {
42 42
 	}
43 43
 
44 44
 	_, _, err := client.SecretInspectWithRaw(context.Background(), "unknown")
45
-	if err == nil || !IsErrSecretNotFound(err) {
45
+	if err == nil || !IsErrNotFound(err) {
46 46
 		t.Fatalf("expected a secretNotFoundError error, got %v", err)
47 47
 	}
48 48
 }
... ...
@@ -31,7 +31,7 @@ func TestServiceInspectServiceNotFound(t *testing.T) {
31 31
 	}
32 32
 
33 33
 	_, _, err := client.ServiceInspectWithRaw(context.Background(), "unknown", types.ServiceInspectOptions{})
34
-	if err == nil || !IsErrServiceNotFound(err) {
34
+	if err == nil || !IsErrNotFound(err) {
35 35
 		t.Fatalf("expected a serviceNotFoundError error, got %v", err)
36 36
 	}
37 37
 }