Skip to content

add test case for KillNonCreateRunHaveNoEffect#607

Merged
zhouhao3 merged 2 commits intoopencontainers:masterfrom
liangchenye:kill
May 11, 2018
Merged

add test case for KillNonCreateRunHaveNoEffect#607
zhouhao3 merged 2 commits intoopencontainers:masterfrom
liangchenye:kill

Conversation

@liangchenye
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

looks good. @wking WDYT?

if err != nil {
return err
}
r.Kill("KILL")
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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