Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test case for KillNonCreateRunHaveNoEffect #607

Merged
merged 2 commits into from
May 11, 2018

Conversation

liangchenye
Copy link
Member

Signed-off-by: Liang Chenye liangchenye@huawei.com

Signed-off-by: Liang Chenye <liangchenye@huawei.com>
@liangchenye liangchenye mentioned this pull request Mar 16, 2018
44 tasks
@liangchenye
Copy link
Member Author

liangchenye commented Mar 16, 2018

Currently we have 4 statuses: creating/created/running/stopped. Since 'created' and 'running' are out of this testing and it is hard to catch the 'creating' status, we can only test the 'stopped' container.

If there were any 'effect' when kill a 'stopped' container, it might reflect on the state. I don't have an idea on other 'effect', so in this PR I check the state changes.

@zhouhao3
Copy link

looks good. @wking WDYT?

if err != nil {
return err
}
r.Kill("KILL")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want to ensure that this call returns an error, based on this and this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* *Exit code:* Zero if the signal was successfully sent to the container process and non-zero on errors.

I found there is no general exit code, there is golang syscall pkg, but just works in posix system.
So do we still need this 'Exit code' session in command-line-interface?

if status, ok := exiterr.Sys().(syscall.WaitStatus); ok {
                log.Printf("Exit Status: %d", status.ExitStatus())
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return error is check in kill.go. There is a bug in the previous kill.go, it displays the wrong spec error code. The new commit 0ddb5cd solves that.

Signed-off-by: Liang Chenye <liangchenye@huawei.com>
@zhouhao3
Copy link

zhouhao3 commented May 11, 2018

LGTM

Approved with PullApprove

@zhouhao3 zhouhao3 merged commit 0f65c57 into opencontainers:master May 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants