Merge pull request #4860 from masters-of-cats/pr-process-not-found-err

Return GRPC not found error instead of plain one
This commit is contained in:
Michael Crosby 2020-12-21 10:25:11 -05:00 committed by GitHub
commit dc207b654d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -1178,6 +1178,10 @@ func TestContainerLoadUnexistingProcess(t *testing.T) {
t.Fatal("an error should have occurred when loading a process that does not exist") t.Fatal("an error should have occurred when loading a process that does not exist")
} }
if !errdefs.IsNotFound(err) {
t.Fatalf("an error of type NotFound should have been returned when loading a process that does not exist, got %#v instead ", err)
}
if err := task.Kill(ctx, syscall.SIGKILL); err != nil { if err := task.Kill(ctx, syscall.SIGKILL); err != nil {
t.Error(err) t.Error(err)
} }

View File

@ -483,7 +483,7 @@ func (s *service) State(ctx context.Context, r *taskAPI.StateRequest) (*taskAPI.
} }
p, err := container.Process(r.ExecID) p, err := container.Process(r.ExecID)
if err != nil { if err != nil {
return nil, err return nil, errdefs.ToGRPC(err)
} }
st, err := p.Status(ctx) st, err := p.Status(ctx)
if err != nil { if err != nil {