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
make TestListPager_EachListItem rework #111241
Conversation
/hold Here are 2 tests where the results look different than expected:
@aojea #111228 (comment) I guess this should also (Please correct me if I am wrong) |
/cc @jpbetz |
/cc @liggitt The last cc didn't seem to work |
I agree the Fatal-or-return logic was wrong and was masking issues with the test I'll defer to @jpbetz' review of the test changes themselves |
/cc @jpbetz |
@@ -301,14 +301,14 @@ func TestListPager_EachListItem(t *testing.T) { | |||
{ | |||
name: "cancel context while processing", | |||
fields: fields{PageSize: 10, PageFn: (&testPager{t: t, expectPage: 10, remaining: 51, rv: "rv:20"}).PagedList}, | |||
want: list(3, "rv:20"), // all the items <= the one the processor returned an error on should have been visited | |||
want: list(10, "rv:20"), // all the items <= the one the processor returned an error on should have been visited |
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 looks right. The whole PageSize
worth of items got returned.
{ | ||
name: "panic processing item", | ||
fields: fields{PageSize: 10, PageFn: (&testPager{t: t, expectPage: 10, remaining: 51, rv: "rv:20"}).PagedList}, | ||
want: list(3, "rv:20"), // all the items <= the one the processor returned an error on should have been visited | ||
want: list(51, "rv:20"), // all the items <= the one the processor returned an error on should have been visited | ||
wantPanic: true, | ||
}, | ||
} |
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 test is just plain wrong. It should have had processorPanicOnItem: 3
set. It overlaps with the above error processing item
and so should just be removed. My apologies.
@@ -345,8 +345,7 @@ func TestListPager_EachListItem(t *testing.T) { | |||
err = p.EachListItem(ctx, metav1.ListOptions{}, fn) | |||
}() | |||
if (panic != nil) && !tt.wantPanic { | |||
t.Fatalf(".EachListItem() panic = %v, wantPanic %v", panic, tt.wantPanic) | |||
} else { | |||
t.Errorf(".EachListItem() panic = %v, wantPanic %v", panic, tt.wantPanic) |
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.
Thanks for catching this.
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
8b0e190
to
5e84f6b
Compare
/assign @caesarxuchao |
/test pull-kubernetes-e2e-gce-ubuntu-containerd |
/unhold ready for review. |
/lgtm Needs approver. |
/Assign @lavalamp |
kindly ping @lavalamp @caesarxuchao for approve, because master is open again for 1.26 =.= |
/approve |
/assign @liggitt for approval,
|
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Abirdcfly, aojea, liggitt 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 |
Signed-off-by: Abirdcfly fp544037857@gmail.com
What type of PR is this?
/kind bug
What this PR does / why we need it:
TestListPager_EachListItem
not work fine.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: