-
Notifications
You must be signed in to change notification settings - Fork 1.1k
removes excessive runs from bats tests #4290
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
Conversation
|
Hi @wgahnagl. Thanks for your PR. I'm waiting for a cri-o member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Codecov Report
@@ Coverage Diff @@
## master #4290 +/- ##
=======================================
Coverage 38.85% 38.85%
=======================================
Files 110 110
Lines 8827 8827
=======================================
Hits 3430 3430
Misses 5013 5013
Partials 384 384 |
|
There are some indentation issues (as seen in https://app.circleci.com/pipelines/github/cri-o/cri-o/6334/workflows/e5fd94c2-903f-40b5-aa80-70402561c757/jobs/101963, or you can just run The |
test/ctr_seccomp.bats
Outdated
| run crictl start "$ctr_id" | ||
| echo "$output" | ||
| [ "$status" -eq 0 ] | ||
| run crictl exec --sync "$ctr_id" chmod 777 . |
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.
ditto
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.
I feel like here I actually should be using run, because it's checking the status and the output ?
test/image.bats
Outdated
| sed -e "s/%VALUE%/quay.io\/crio\/redis:alpine/g" "$TESTDATA"/container_config_by_imageid.json > "$TESTDIR"/ctr_by_imagetag.json | ||
| pod_id=$(crictl runp "$TESTDATA"/sandbox_config.json) | ||
|
|
||
| sed -e "s/%VALUE%/quay.io\/crio\/redis:alpine/g" "$TESTDATA"/container_config_by_imageid.json > "$TESTDIR"/ctr_by_imagetag.json |
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.
ditto
|
|
||
| @test "inspect image should succed contain all necessary information" { | ||
| run crictl inspecti quay.io/crio/redis:alpine | jq -e .status.size | ||
| run crictl inspecti quay.io/crio/redis:alpine | jq -e .info.imageSpec.config.Cmd |
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.
The funny thing is, this was not working at all because
runate all the output.jqjust ignore empty input.
Now it's working, but the issue 2 still remains, so the correct way to fix this is
output=$(crictl inspecti quay.io/crio/redis:alpine)
[ "$output" != "" ]
jq -e '.status.size'<<< "$output"
jq -e '.info.imageSpec.config.Cmd' <<< "$output"(can and should be addressed by a separate commit; same PR is fine)
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.
Just tested on my machine
[kir@kir-rhat selinux]$ out=$(sudo crictl inspecti quay.io/crio/redis:alpine)
[kir@kir-rhat selinux]$ jq -e '.status.size' <<<$out
"28148166"| pod_list_info=$(crictl pods --quiet --id "$pod_id") | ||
|
|
||
| output=$(crictl inspectp -o json "$pod_id") | ||
| pod_status_info=$(echo "$output" | jq ".status.state") |
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.
Since jq ignores empty input (see previous comment), there should be a check for non-empty output added here. Can be addressed either right here or separately.
| echo "$output" | ||
| [ "$status" -eq 0 ] | ||
| output=$(crictl inspectp -o json "$pod_id") | ||
| status_output=$(echo "$output" | jq ".status.state") |
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.
check for empty output needed because of jq (see above comments)
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.
and jq probably needs -e so it errors out if .status.state is not found
| echo "$output" | ||
| [ "$status" -eq 0 ] | ||
| [[ "${output}" != "" ]] | ||
| output=$(crictl ps --quiet --all) |
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.
check for non-empty output is removed but that's OK because it was redundance since we check for a particular string below.
| echo "$output" | ||
| [ "$status" -eq 0 ] | ||
| [[ "${output}" != "" ]] | ||
| output=$(crictl ps --quiet --all) |
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.
non-empty output check is removed but it's OK since we have a check for a concrete value below.
kolyshkin
left a comment
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.
Good job overall, left a few issues that need to be addressed.
test/restore.bats
Outdated
| pod_status_info=$(echo "$output" | grep ^Status) | ||
| pod_id=$(crictl runp "$TESTDATA"/sandbox_config.json) | ||
| pod_list_info=$(crictl pods --quiet --id "$pod_id" | ||
| ) |
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.
whoops, this should be on the previous line
|
/ok-to-test |
kolyshkin
left a comment
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.
left a few suggestions
89a40d1 to
ea87fae
Compare
ac18908 to
d455317
Compare
|
One single shfmt issue remaining; otherwise I think one this is good to go |
Signed-off-by: Skyler Clark <[email protected]>
|
/retest |
kolyshkin
left a comment
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
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kolyshkin, mrunalp, wgahnagl The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/lgtm |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Removes excessive runs from the bats tests
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?