Transfer error to ErrNotFound when kill a not exist container, also add

test case.

Signed-off-by: payall4u <404977848@qq.com>

Add integration test case

Signed-off-by: payall4u <404977848@qq.com>
This commit is contained in:
payall4u
2020-04-27 10:53:20 +08:00
parent 83084c9328
commit b437938d2f
3 changed files with 81 additions and 2 deletions

View File

@@ -137,6 +137,8 @@ func checkKillError(err error) error {
strings.Contains(strings.ToLower(err.Error()), "no such process") ||
err == unix.ESRCH {
return errors.Wrapf(errdefs.ErrNotFound, "process already finished")
} else if strings.Contains(err.Error(), "does not exist") {
return errors.Wrapf(errdefs.ErrNotFound, "no such container")
}
return errors.Wrapf(err, "unknown error after kill")
}