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

critest: Add test for exec #269

Merged
merged 3 commits into from
Mar 27, 2018
Merged

Conversation

umohnani8
Copy link
Contributor

Add test for exec where tty and stdin set to true

Signed-off-by: umohnani8 [email protected]

Add test for exec where tty and stdin set to true

Signed-off-by: umohnani8 <[email protected]>
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 15, 2018
@umohnani8
Copy link
Contributor Author

@mrunalp PTAL

@umohnani8
Copy link
Contributor Author

The exec test with stdin=true and tty=true is passing on cri-o, but fails on docker. Could be a bug in docker?

@feiskyer
Copy link
Member

For stdin=true and tty=true, docker exec will stop as soon as stdin is closed (and so with containerd @Random-Liu). Since the input is an empty buffer, it is closed immediately, so the output streams are closed immediately, too.

@umohnani8 Could you keep the stdin open until getting the output in checkExec()?

@umohnani8
Copy link
Contributor Author

@feiskyer how do I do that in the test? I thought the StreamOptions was accounting for that.

@feiskyer
Copy link
Member

@umohnani8 Let me add a patch to your PR

framework.Logf("Get exec url: " + resp.Url)
return resp.Url
}

func checkExec(c internalapi.RuntimeService, execServerURL string) {
func checkExec(c internalapi.RuntimeService, execServerURL, stdout string, isTty bool) {
localOut := &bytes.Buffer{}
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Good catch 👍

@umohnani8
Copy link
Contributor Author

@feiskyer I see now, thanks for the patch :)

@Random-Liu
Copy link
Contributor

Random-Liu commented Mar 26, 2018

Actually we should test different behaviors when stdin and tty are true/false. Currently, the 2 test cases are exactly the same.

/lgtm
For now.

@Random-Liu Random-Liu mentioned this pull request Mar 26, 2018
@feiskyer feiskyer merged commit 039f0ac into kubernetes-sigs:master Mar 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants