-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
System tests: tighten 'is' operator #11776
System tests: tighten 'is' operator #11776
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: edsantiago The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold DO NOT MERGE. This cannot merge until #11775 is fixed! That's a serious nasty flake, and I bet this PR will hit it on most if not all of the |
Well, phooey! There's a new flake:
I'll worry about it tomorrow. |
And yet another different one:
|
Nice work, that should help my brain to parse the errors. |
ea3379f
to
f0db4ea
Compare
#11784 is an issue in runc. I suggest we just skip the test with runc and move on |
and probably also #10442 |
2ab71bf
to
7e77927
Compare
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.
test/system/005-info.bats
Outdated
@@ -37,7 +37,7 @@ cgroupVersion: v[12] | |||
# FIXME: if we're ever able to get package versions on Debian, | |||
# add '-[0-9]' to all '*.package' queries below. | |||
tests=" | |||
host.buildahVersion | [0-9.] | |||
host.buildahVersion | [0-9.]\\\+ |
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.
This will now fail if we ever vendor a -dev
buildah, or something with letters.
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.
We regularly do this during development, will this block a merge to upstream?
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.
It probably would. Let me think of how to handle that; I will pore through git logs, find patterns, and resubmit. Thanks for letting me know.
@@ -20,26 +20,26 @@ load helpers | |||
# Simple import | |||
run_podman import -q $archive | |||
iid="$output" | |||
run_podman run -t --rm $iid cat /random.txt | |||
run_podman run --rm $iid cat /random.txt |
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.
-t
is tested in 450-interactive.bats (below), so I see little need to jump through the carriage-return hoops here. Please advise if there's something I've missed.
@@ -245,7 +245,7 @@ function _test_skopeo_credential_sharing() { | |||
is "$status" "0" "skopeo inspect - exit status" | |||
|
|||
got_name=$(jq -r .Name <<<"$output") | |||
is "$got_name" "$registry/$dest_name" "skopeo inspect -> Name" | |||
is "$got_name" "$registry/$destname" "skopeo inspect -> Name" |
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.
Oops. My bad. This has been broken from the beginning. This is a great example of why we need this PR.
is "$(echo $(sort <<<$output))" "${v[4]} ${v[5]} ${v[6]}" \ | ||
"volume prune, with 1, 2, 3 in use, deletes only 4, 5, 6" |
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.
This is another great example of why we need this PR. Between the time I wrote this test and today, someone added some new volumes, and this check was not catching the addition.
@@ -30,7 +30,7 @@ spec: | |||
containers: | |||
- command: | |||
- sleep | |||
- "100" | |||
- \"100\" |
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.
This and line 52 are completely unrelated; it's just something that makes color highlighting work better in my editors.
LGTM |
/hold |
Fix day-one sloppiness: when I first wrote this framework it compared strings using 'expr', not '=', to be more forgiving of extra cruft in output. This was a bad decision. It means that warnings or additional text are ignored: is "all is ok, NOT!" "all is ok" <-- this would pass Solution: tighten up the 'is' check. Use '=' (direct compare) first. If it fails, look for wild cards ('*') or character classes ('[') in the expect string. If so, and only then, use 'expr'. And, thanks to a clever suggestion from Luap99, include '(using expr)' in the error message when we do so; this could make it easier for a developer to understand a string mismatch. This change exposes a lot of instances in which we weren't doing proper comparisons. Fix those. Thankfully, there weren't as many as I'd feared. Also, and completely unrelated, add '-T' flag to bats helper, for showing timing results. (I will open this as a separate PR if requested. I too find it offensive to jumble together unrelated commits.) Signed-off-by: Ed Santiago <[email protected]>
7e77927
to
bf94ebf
Compare
@@ -37,7 +37,7 @@ cgroupVersion: v[12] | |||
# FIXME: if we're ever able to get package versions on Debian, | |||
# add '-[0-9]' to all '*.package' queries below. | |||
tests=" | |||
host.buildahVersion | [0-9.] | |||
host.buildahVersion | [1-9][0-9]*\.[0-9.]\\\+.* |
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.
Update on the -dev
issue: I confirmed (back to 1.4) that the only values are N.M
and N.M-dev
, but then ended up unable to use expr
to handle -dev
. So the above expression now handles N.M
with any suffix, such as 1.23.0-dev
but also 1.23abcfoothisisnonsensehellogoodbye
. I think we'll need to call that Good Enough.
Ready again. If there are in-flight PRs which add BATS tests that do lax checking, and they merge without rebasing, we may end up with a broken main. I've looked through the top half of open PRs and see none, but I might have missed one. |
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
Fix day-one sloppiness: when I first wrote this framework
it compared strings using 'expr', not '=', to be more
forgiving of extra cruft in output. This was a bad decision.
It means that warnings or additional text are ignored:
Solution: tighten up the 'is' check. Use '=' (direct
compare) first. If it fails, look for wild cards ('*')
or character classes ('[') in the expect string. If
so, and only then, use 'expr'. And, thanks to a clever
suggestion from Luap99, include '(using expr)' in the
error message when we do so; this could make it easier
for a developer to understand a string mismatch.
This change exposes a lot of instances in which we weren't
doing proper comparisons. Fix those. Thankfully, there
weren't as many as I'd feared.
Also, and completely unrelated, add '-T' flag to bats
helper, for showing timing results. (I will open this
as a separate PR if requested. I too find it offensive
to jumble together unrelated commits.)
Signed-off-by: Ed Santiago [email protected]