Skip to content

Commit

Permalink
Separate out personality errors and address them in the tests
Browse files Browse the repository at this point in the history
Also force a build
  • Loading branch information
matthewavery committed Feb 25, 2018
1 parent 8ae2bd1 commit 96aa3de
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/apiservers/engine/backends/container_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func (c *ContainerProxy) InspectTask(op trace.Operation, handle string, eid stri
case *tasks.InspectNotFound:
// These error types may need to be expanded. NotFoundError does not fit here.
op.Errorf("received a TaskNotFound error during task inspect: %s", err.Payload.Message)
return nil, TaskNotFoundError(fmt.Sprintf("container (%s) has been stopped", cid))
return nil, TaskPoweredOffError(cid)
case *tasks.InspectInternalServerError:
op.Errorf("received an internal server error during task inspect: %s", err.Payload.Message)
return nil, InternalServerError(err.Payload.Message)
Expand All @@ -368,7 +368,7 @@ func (c *ContainerProxy) BindTask(op trace.Operation, handle string, eid string)
switch err := err.(type) {
case *tasks.BindNotFound:
op.Errorf("received TaskNotFound error during task bind: %s", err.Payload.Message)
return "", TaskNotFoundError("container (%s) has been stopped")
return "", TaskBindPowerError()
case *tasks.BindInternalServerError:
op.Errorf("received unexpected error attempting to bind task(%s) for handle(%s): %s", eid, handle, err.Payload.Message)
return "", InternalServerError(err.Payload.Message)
Expand Down
8 changes: 8 additions & 0 deletions lib/apiservers/engine/backends/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ func TaskInspectNotFoundError(msg string) error {
return derr.NewRequestNotFoundError(fmt.Errorf("No container was found with exec id: %s", msg))
}

func TaskBindPowerError() error {
return derr.NewRequestNotFoundError(fmt.Errorf("the container has been stopped"))
}

func TaskPoweredOffError(msg string) error {
return derr.NewRequestNotFoundError(fmt.Errorf("container (%s) has been stopped", msg))
}

func ImageNotFoundError(image, tag string) error {
return derr.NewRequestNotFoundError(fmt.Errorf("An image does not exist locally with the tag: %s", image))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Verify Poweroff During Exec Error Message
Set Test Variable ${msg3} Unable to wait for task when container ${containerID} is not running
Set Test Variable ${msg4} the Container(${containerID}) has been shutdown during execution of the exec operation
Set Test Variable ${msg5} container(${containerID}) must be powered on in order to perform the desired exec operation
Set Test Variable ${msg6} the container has been stopped

Should Contain Any ${error} ${msg1} ${msg2} ${msg3} ${msg4} ${msg5}

Verify No Poweroff During Exec Error Message
Expand Down

0 comments on commit 96aa3de

Please sign in to comment.