-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
test: fix flaky dispatch loop #50446
Conversation
Hi @ywqzzy. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with 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/test-infra repository. |
/check-issue-triage-complete |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #50446 +/- ##
=================================================
- Coverage 70.1114% 55.4459% -14.6656%
=================================================
Files 1444 1556 +112
Lines 419923 587026 +167103
=================================================
+ Hits 294414 325482 +31068
- Misses 105281 238795 +133514
- Partials 20228 22749 +2521
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -535,6 +535,9 @@ func TestManagerDispatchLoop(t *testing.T) { | |||
scheduler.RegisterSchedulerFactory(proto.TaskTypeExample, | |||
func(ctx context.Context, task *proto.Task, param scheduler.Param) scheduler.Scheduler { | |||
idx := counter.Load() | |||
if int(idx) > len(concurrencies) { |
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.
might panic again when return nil
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.
we should add a check in mockScheduler.EXPECT().ScheduleTask().Do(func() {
, when task already success, just return
/hold |
}) | ||
mockScheduler.EXPECT().Close() | ||
counter.Add(1) | ||
waitChannels[task.Key] = make(chan struct{}) |
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.
init this map before create task, else there might be data race
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: D3Hunter, hawkingrei 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 |
[LGTM Timeline notifier]Timeline:
|
/unhold |
What problem does this PR solve?
Issue Number: close #50409
Problem Summary:
What changed and how does it work?
Don't start scheduler if it start time(counter) > len(concurrencies)
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.