linux, linux/shim: remove error definitions
Since we now have a common set of error definitions, mapped to existing error codes, we no longer need the specialized error codes used for interaction with linux processes. The main issue was that string matching was being used to map these to useful error codes. With this change, we use errors defined in the `errdefs` package, which map cleanly to GRPC error codes and are recoverable on either side of the request. The main focus of this PR was in removin these from the shim. We may need follow ups to ensure error codes are preserved by the `Tasks` service. Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/containerd/cgroups"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
||||
|
||||
@@ -632,8 +633,8 @@ func TestDeleteRunningContainer(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Error("delete did not error with running task")
|
||||
}
|
||||
if err != ErrDeleteRunningTask {
|
||||
t.Errorf("expected error %q but received %q", ErrDeleteRunningTask, err)
|
||||
if !errdefs.IsFailedPrecondition(err) {
|
||||
t.Errorf("expected error %q but received %q", errdefs.ErrFailedPrecondition, err)
|
||||
}
|
||||
if err := task.Kill(ctx, syscall.SIGKILL); err != nil {
|
||||
t.Error(err)
|
||||
@@ -703,8 +704,8 @@ func TestContainerKill(t *testing.T) {
|
||||
t.Error("second call to kill should return an error")
|
||||
return
|
||||
}
|
||||
if err != ErrProcessExited {
|
||||
t.Errorf("expected error %q but received %q", ErrProcessExited, err)
|
||||
if !errdefs.IsNotFound(err) {
|
||||
t.Errorf("expected error %q but received %q", errdefs.ErrNotFound, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user