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

Add containers test #1194

Merged
merged 3 commits into from Nov 20, 2023
Merged

Add containers test #1194

merged 3 commits into from Nov 20, 2023

Conversation

bitoku
Copy link
Contributor

@bitoku bitoku commented Jun 17, 2023

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

This PR adds unit tests to crictl (a part of container.go).
This also adds stretchr/testify and go-test/deep library.

Which issue(s) this PR fixes:

#1152

Special notes for your reviewer:

I wrote tests with default unittest framework.
Which do you prefer to use test framework, ginkgo or default?
Exisiting unittests in cmd/crictl is written with the default one.

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 17, 2023
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jun 17, 2023
Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

Thank you for working on this, @bitoku! 🙏

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 19, 2023
@bitoku
Copy link
Contributor Author

bitoku commented Jun 19, 2023

There seems no CI for crictl so I added them as well.
Thank you for reviewing!

@bitoku
Copy link
Contributor Author

bitoku commented Nov 10, 2023

sorry for the late reaction.
I reflected your comment. could you please review it again?

@saschagrunert
Copy link
Member

@SergeyKanzhelev PTAL again

Copy link
Member

@SergeyKanzhelev SergeyKanzhelev left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 14, 2023
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 15, 2023
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 15, 2023
@bitoku
Copy link
Contributor Author

bitoku commented Nov 15, 2023

I'm sorry for bothering you many times.
I tested it locally and it worked this time. not sure why it failed because it looks ok. need to check.

https://github.com/kubernetes-sigs/cri-tools/actions/runs/6874923452/job/18697587316?pr=1194

@saschagrunert
Copy link
Member

saschagrunert commented Nov 15, 2023

I don't get why we're getting an exit code 1 for all successful tests 🤔 But ginkgo is indicating that the suite failed.

@SergeyKanzhelev
Copy link
Member

Couple options to debug - increase the ginkgo log level and try removing the -p as a test. There is definitely something happens. Maybe a panic or something that is not being logged

Signed-off-by: Ayato Tokubi <atokubi@redhat.com>
Signed-off-by: Ayato Tokubi <atokubi@redhat.com>
Signed-off-by: Ayato Tokubi <atokubi@redhat.com>
@bitoku
Copy link
Contributor Author

bitoku commented Nov 20, 2023

After some research I found the reason why it failed.

First of all, the reason it didn't happen in my local env was that I didn't rebase it onto upstream/main. After rebasing it, I was able to reproduce it.

And the CI failed because ginkgo somehow runs templates_test.go, which doesn't use ginkgo, and its test failed.
I don't know why ginkgo runs no-ginkgo spec file. I raised a issue about it (onsi/ginkgo#1303).

templates_test.go failed because of this change 092eddc#diff-911ebdfd44eef4e1d8f910ef1839b3e99c09a2fc4da1eb8b8f464e5bbfcafe9c .

strings.Title and cases.Title behave differently. To match cases.Title with strings.Title, it needs cases.NoLower as its option.
https://go.dev/play/p/jDL6uoPVB28

I tested in my local and my forked repo, and it worked so I believe it works this time...

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 20, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bitoku, saschagrunert, SergeyKanzhelev

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 93cf30d into kubernetes-sigs:master Nov 20, 2023
23 checks passed
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants