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
Fix TestStartingResourceVersion flakiness #96662
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wojtek-t 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 |
5d2dcc1
to
deb9c3b
Compare
/retest |
1 similar comment
/retest |
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 code looks right, just a couple nits around how the test is described in the comments.
@@ -1006,6 +1006,84 @@ func (f *fakeTimeBudget) takeAvailable() time.Duration { | |||
|
|||
func (f *fakeTimeBudget) returnUnused(_ time.Duration) {} | |||
|
|||
func TestStartingResourceVersion(t *testing.T) { |
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.
nit: Moving this function makes for a diff that is difficult to review.
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.
Yes - but in order to fake dispatchBudget (which is private field) it has to be here :(
// When using the official `timeBudgetImpl` we were observing flakiness | ||
// due under the following conditions: |
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.
nit: Took me a while to understand what this meant. Maybe explain what the current test does instead of what the PR change? I.e. "Use a fake timeBudget to prevent this test from flaking under the following conditions:"?
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.
done
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.
BTW - the comment was copy-pasted from other test and wasn't accurate for this test - fixed that too.
// 3) if the test was cpu-starved and we weren't able to consume events | ||
// from w2 ResultCh it could have happened that its buffer was also | ||
// filling in and given we no longer had timeBudget (consumed in (1)) | ||
// trying to put next item was simply breaking the watch |
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.
Can we clarify why this works okay in production but not in test? It's not obvious to me from reading this.
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 may happen and watch can be resumed by the client. But this won't test what we want to test.
Added a comment.
deb9c3b
to
37b0004
Compare
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.
@jpbetz - thanks for comments; PTAL
@@ -1006,6 +1006,84 @@ func (f *fakeTimeBudget) takeAvailable() time.Duration { | |||
|
|||
func (f *fakeTimeBudget) returnUnused(_ time.Duration) {} | |||
|
|||
func TestStartingResourceVersion(t *testing.T) { |
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.
Yes - but in order to fake dispatchBudget (which is private field) it has to be here :(
// When using the official `timeBudgetImpl` we were observing flakiness | ||
// due under the following conditions: |
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.
done
// When using the official `timeBudgetImpl` we were observing flakiness | ||
// due under the following conditions: |
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.
BTW - the comment was copy-pasted from other test and wasn't accurate for this test - fixed that too.
// 3) if the test was cpu-starved and we weren't able to consume events | ||
// from w2 ResultCh it could have happened that its buffer was also | ||
// filling in and given we no longer had timeBudget (consumed in (1)) | ||
// trying to put next item was simply breaking the watch |
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 may happen and watch can be resumed by the client. But this won't test what we want to test.
Added a comment.
/retest |
/lgtm Thanks for the flake fix! |
/test pull-kubernetes-e2e-kind-ipv6 |
1 similar comment
/test pull-kubernetes-e2e-kind-ipv6 |
/triage accepted |
/retest |
/retest Review the full test history for this PR. Silence the bot with an |
Fix #96649
/kind flake
/priority important-soon
/milestone v1.20