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

Remove deprecated error checks
This commit is contained in:
Yong Tang 2017-10-03 06:40:47 -07:00 committed by GitHub
commit 882563b2d6
9 changed files with 9 additions and 89 deletions

View file

@ -62,7 +62,7 @@ func TestCheckpointListContainerNotFound(t *testing.T) {
}
_, err := client.CheckpointList(context.Background(), "unknown", types.CheckpointListOptions{})
if err == nil || !IsErrContainerNotFound(err) {
if err == nil || !IsErrNotFound(err) {
t.Fatalf("expected a containerNotFound error, got %v", err)
}
}

View file

@ -42,7 +42,7 @@ func TestConfigInspectConfigNotFound(t *testing.T) {
}
_, _, err := client.ConfigInspectWithRaw(context.Background(), "unknown")
if err == nil || !IsErrConfigNotFound(err) {
if err == nil || !IsErrNotFound(err) {
t.Fatalf("expected a configNotFoundError error, got %v", err)
}
}
@ -53,7 +53,7 @@ func TestConfigInspect(t *testing.T) {
version: "1.30",
client: newMockClient(func(req *http.Request) (*http.Response, error) {
if !strings.HasPrefix(req.URL.Path, expectedURL) {
return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL)
return nil, fmt.Errorf("expected URL '%s', got '%s'", expectedURL, req.URL)
}
content, err := json.Marshal(swarm.Config{
ID: "config_id",

View file

@ -37,7 +37,7 @@ func TestContainerCreateImageNotFound(t *testing.T) {
client: newMockClient(errorMock(http.StatusNotFound, "No such image")),
}
_, err := client.ContainerCreate(context.Background(), &container.Config{Image: "unknown_image"}, nil, nil, "unknown")
if err == nil || !IsErrImageNotFound(err) {
if err == nil || !IsErrNotFound(err) {
t.Fatalf("expected an imageNotFound error, got %v", err)
}
}

View file

@ -30,7 +30,7 @@ func TestContainerInspectContainerNotFound(t *testing.T) {
}
_, err := client.ContainerInspect(context.Background(), "unknown")
if err == nil || !IsErrContainerNotFound(err) {
if err == nil || !IsErrNotFound(err) {
t.Fatalf("expected a containerNotFound error, got %v", err)
}
}

View file

@ -71,38 +71,6 @@ func wrapResponseError(err error, resp serverResponse, object, id string) error
}
}
// IsErrImageNotFound returns true if the error is caused
// when an image is not found in the docker host.
//
// Deprecated: Use IsErrNotFound
func IsErrImageNotFound(err error) bool {
return IsErrNotFound(err)
}
// IsErrContainerNotFound returns true if the error is caused
// when a container is not found in the docker host.
//
// Deprecated: Use IsErrNotFound
func IsErrContainerNotFound(err error) bool {
return IsErrNotFound(err)
}
// IsErrNetworkNotFound returns true if the error is caused
// when a network is not found in the docker host.
//
// Deprecated: Use IsErrNotFound
func IsErrNetworkNotFound(err error) bool {
return IsErrNotFound(err)
}
// IsErrVolumeNotFound returns true if the error is caused
// when a volume is not found in the docker host.
//
// Deprecated: Use IsErrNotFound
func IsErrVolumeNotFound(err error) bool {
return IsErrNotFound(err)
}
// unauthorizedError represents an authorization error in a remote registry.
type unauthorizedError struct {
cause error
@ -120,30 +88,6 @@ func IsErrUnauthorized(err error) bool {
return ok
}
// IsErrNodeNotFound returns true if the error is caused
// when a node is not found.
//
// Deprecated: Use IsErrNotFound
func IsErrNodeNotFound(err error) bool {
return IsErrNotFound(err)
}
// IsErrServiceNotFound returns true if the error is caused
// when a service is not found.
//
// Deprecated: Use IsErrNotFound
func IsErrServiceNotFound(err error) bool {
return IsErrNotFound(err)
}
// IsErrTaskNotFound returns true if the error is caused
// when a task is not found.
//
// Deprecated: Use IsErrNotFound
func IsErrTaskNotFound(err error) bool {
return IsErrNotFound(err)
}
type pluginPermissionDenied struct {
name string
}
@ -187,27 +131,3 @@ func (cli *Client) NewVersionError(APIrequired, feature string) error {
}
return nil
}
// IsErrSecretNotFound returns true if the error is caused
// when a secret is not found.
//
// Deprecated: Use IsErrNotFound
func IsErrSecretNotFound(err error) bool {
return IsErrNotFound(err)
}
// IsErrConfigNotFound returns true if the error is caused
// when a config is not found.
//
// Deprecated: Use IsErrNotFound
func IsErrConfigNotFound(err error) bool {
return IsErrNotFound(err)
}
// IsErrPluginNotFound returns true if the error is caused
// when a plugin is not found in the docker host.
//
// Deprecated: Use IsErrNotFound
func IsErrPluginNotFound(err error) bool {
return IsErrNotFound(err)
}

View file

@ -31,7 +31,7 @@ func TestImageInspectImageNotFound(t *testing.T) {
}
_, _, err := client.ImageInspectWithRaw(context.Background(), "unknown")
if err == nil || !IsErrImageNotFound(err) {
if err == nil || !IsErrNotFound(err) {
t.Fatalf("expected an imageNotFound error, got %v", err)
}
}

View file

@ -30,7 +30,7 @@ func TestNodeInspectNodeNotFound(t *testing.T) {
}
_, _, err := client.NodeInspectWithRaw(context.Background(), "unknown")
if err == nil || !IsErrNodeNotFound(err) {
if err == nil || !IsErrNotFound(err) {
t.Fatalf("expected a nodeNotFoundError error, got %v", err)
}
}

View file

@ -42,7 +42,7 @@ func TestSecretInspectSecretNotFound(t *testing.T) {
}
_, _, err := client.SecretInspectWithRaw(context.Background(), "unknown")
if err == nil || !IsErrSecretNotFound(err) {
if err == nil || !IsErrNotFound(err) {
t.Fatalf("expected a secretNotFoundError error, got %v", err)
}
}

View file

@ -31,7 +31,7 @@ func TestServiceInspectServiceNotFound(t *testing.T) {
}
_, _, err := client.ServiceInspectWithRaw(context.Background(), "unknown", types.ServiceInspectOptions{})
if err == nil || !IsErrServiceNotFound(err) {
if err == nil || !IsErrNotFound(err) {
t.Fatalf("expected a serviceNotFoundError error, got %v", err)
}
}