-
Notifications
You must be signed in to change notification settings - Fork 1.4k
🌱 Added test cases for list.go and github.go #11937
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
base: main
Are you sure you want to change the base?
🌱 Added test cases for list.go and github.go #11937
Conversation
Hi @irapandey. Thanks for your PR. I'm waiting for a kubernetes-sigs 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. 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-sigs/prow repository. |
Hey @chandankumar4 - Can you take a look here |
/ok-to-test |
Please take a look at the linter findings. As soon as they got fixed I'd take a look at this PR :-) |
e246d5c
to
6b3dea8
Compare
6b3dea8
to
8b3ece5
Compare
/re-test |
Hey @chrischdi I think the lint task failed due to some error in setup - can we have this re-run so you can review it? Thanks 😄 |
👍 Triggered a rerun. |
name: "Successful PR Listing", | ||
fields: &githubFromToPRLister{ | ||
client: &githubClient{ | ||
repo: "kubernetes-sigs/kind", |
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.
How about using kubernetes-sigs/cluster-api ?
Probably, to use kind repository doesn't affect in the future, but to use cluster-api is more safety since the repo is itself.
{ | ||
name: "Successful PR Listing", | ||
fields: &githubFromToPRLister{ | ||
client: &githubClient{ |
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.
Wondering if we should better use some mock client instead of reaching out to github on unit tests (rate-limiting could apply and make the test flaky)
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 agree with @chrischdi
In this case, to reach out to GitHub generates possibility about flaky. For example, when some PR piles the commit in a short period of time, we'll met the rate limit error. Then it's not problem even if we use mock client since we know the result at this time. In the future, using mock might not be problem.
func Test_githubFromToPRLister_listPRs(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
fields *githubFromToPRLister |
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.
fields *githubFromToPRLister | |
lister *githubFromToPRLister |
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.
+1
l := &githubFromToPRLister{ | ||
client: tt.fields.client, | ||
fromRef: tt.fields.fromRef, | ||
toRef: tt.fields.toRef, | ||
branch: tt.fields.branch, | ||
} | ||
_, err := l.listPRs(tt.args) |
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.
l := &githubFromToPRLister{ | |
client: tt.fields.client, | |
fromRef: tt.fields.fromRef, | |
toRef: tt.fields.toRef, | |
branch: tt.fields.branch, | |
} | |
_, err := l.listPRs(tt.args) | |
_, err := tt.lister.listPRs(tt.args) |
@irapandey do you have time to address the findings? |
@chrischdi - Might have missed the updates here |
580172b
to
321b6c9
Compare
This reverts commit 321b6c9.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
This PR adds unit tests for release note generator to add more coverage to non-covered functions
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
#11368
/area testing
