Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@wgahnagl
Copy link
Contributor

What type of PR is this?

/kind api-change
/kind bug

/kind cleanup

/kind dependency-change
/kind deprecation
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

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?

none

@openshift-ci-robot openshift-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. release-note-none Denotes a PR that doesn't merit a release note. labels Oct 21, 2020
@openshift-ci-robot
Copy link

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@openshift-ci-robot openshift-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 21, 2020
@wgahnagl wgahnagl changed the title removes runs removes excessive runs from bats tests Oct 21, 2020
@codecov
Copy link

codecov bot commented Oct 21, 2020

Codecov Report

Merging #4290 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #4290   +/-   ##
=======================================
  Coverage   38.85%   38.85%           
=======================================
  Files         110      110           
  Lines        8827     8827           
=======================================
  Hits         3430     3430           
  Misses       5013     5013           
  Partials      384      384           

@kolyshkin
Copy link
Collaborator

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 make shfmt).

The integration-cgroups failure in pipeline CI job appears to be a flake (caused by slow circleci?)

run crictl start "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run crictl exec --sync "$ctr_id" chmod 777 .
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor Author

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
Copy link
Collaborator

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
Copy link
Collaborator

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

  1. run ate all the output.
  2. jq just 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)

Copy link
Collaborator

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")
Copy link
Collaborator

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")
Copy link
Collaborator

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)

Copy link
Collaborator

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)
Copy link
Collaborator

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)
Copy link
Collaborator

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.

Copy link
Collaborator

@kolyshkin kolyshkin left a 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.

pod_status_info=$(echo "$output" | grep ^Status)
pod_id=$(crictl runp "$TESTDATA"/sandbox_config.json)
pod_list_info=$(crictl pods --quiet --id "$pod_id"
)
Copy link
Collaborator

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

@saschagrunert
Copy link
Member

/ok-to-test

@openshift-ci-robot openshift-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 22, 2020
Copy link
Collaborator

@kolyshkin kolyshkin left a 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

@wgahnagl wgahnagl force-pushed the remove_run branch 2 times, most recently from 89a40d1 to ea87fae Compare October 23, 2020 13:48
@openshift-ci-robot openshift-ci-robot added dco-signoff: no Indicates the PR's author has not DCO signed all their commits. and removed dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Oct 23, 2020
@openshift-ci-robot openshift-ci-robot added dco-signoff: yes Indicates the PR's author has DCO signed all their commits. and removed dco-signoff: no Indicates the PR's author has not DCO signed all their commits. labels Oct 23, 2020
@wgahnagl wgahnagl force-pushed the remove_run branch 2 times, most recently from ac18908 to d455317 Compare October 26, 2020 18:19
@kolyshkin
Copy link
Collaborator

One single shfmt issue remaining; otherwise I think one this is good to go
https://app.circleci.com/pipelines/github/cri-o/cri-o/6433/workflows/480e8334-0c16-4791-a740-ff02d0b2b8e4/jobs/103551

Signed-off-by: Skyler Clark <[email protected]>
@kolyshkin
Copy link
Collaborator

/retest

Copy link
Collaborator

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

LGTM

@openshift-ci-robot
Copy link

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 27, 2020
@mrunalp
Copy link
Member

mrunalp commented Oct 27, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 27, 2020
@openshift-merge-robot openshift-merge-robot merged commit 0f31184 into cri-o:master Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants