-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
tests/integration: rm excessive run use; fix exec --preserve-fds test #2658
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kolyshkin
force-pushed
the
tests-ex-run
branch
2 times, most recently
from
October 22, 2020 18:25
20222d9
to
fe04872
Compare
kolyshkin
changed the title
tests/integration: rm excessive run use
tests/integration: rm excessive run use; fix exec --preserve-fds test
Oct 22, 2020
giuseppe
previously approved these changes
Oct 22, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Not a maintainer but I've introduced the issue fixed by the second commit
kolyshkin
force-pushed
the
tests-ex-run
branch
from
October 22, 2020 18:41
fe04872
to
c30dd3f
Compare
mrunalp
previously approved these changes
Oct 22, 2020
kolyshkin
force-pushed
the
tests-ex-run
branch
2 times, most recently
from
October 27, 2020 18:15
8573f2b
to
ac8e585
Compare
1. Fix the check, mostly by changing `cat hello` to `echo hello`, and checking for "hello" rather than *"hello"*. Previously, `cat hello` generated `cat: hello: no such file or directory` error message, which `run` added to `$output` and so the check for $output containing `hello` worked! 2. Simplify the test by not using the subshell and the `run`. The only catch is, fd 3 is used by bats itself, so we have to use fd 4 and thus --preserve-fds 2. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
In its current form, it is complicated, unreliable, and error prone. Using runc delete -f will kill and remove any container, running or not, and it won't error if a container with a given name does not exist. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Bats' run should only be used when we want to check both the command output and its non-zero exit status. Otherwise, we can rely on implicit exit code check (as the tests are run with set -e), or use if, etc. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
kolyshkin
force-pushed
the
tests-ex-run
branch
from
October 29, 2020 23:49
ac8e585
to
2ceb971
Compare
Rebased on top of #2666 to fix CI |
Hmm I think I've seen it before... Update: this is another time we see #2425 |
restarted CI |
@AkihiroSuda @mrunalp PTAL |
mrunalp
approved these changes
Nov 6, 2020
@AkihiroSuda PTAL |
AkihiroSuda
approved these changes
Nov 6, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1. rm excessive
run
useBats' run should only be used when we want to check both the command
output and its non-zero exit status.
Otherwise, we can rely on implicit exit code check (as the tests are
run with set -e), or use if, etc.
2. fix "runc exec --preserve-fds" test case
Fix the check, mostly by changing
cat hello
toecho hello
,and checking for
"hello"
(whole string) rather than*"hello"*
(substring).Previously,
cat hello
generatedcat: hello: no such file or directory
error message, which
run
added to$output
andso the check for $output containing
hello
worked!Simplify the test by not using the subshell and the
run
.The only catch is, fd 3 is used by bats itself, so we have to use
fd 4 and thus --preserve-fds 2.
3. simplify
teardown_running_container
In its current form, it is complicated, unreliable, and error prone (TOCTOU etc)
Using
runc delete -f
will kill and remove any container, running or not,and it won't error if a container with a given name does not exist.