Skip to content

core/scheduler: fix flaky TestSchedulerWait clock rewind - #4726

Open
KaloyanTanev wants to merge 1 commit into
mainfrom
kalo/fix-scheduler-wait-flake
Open

KaloyanTanev wants to merge 1 commit into
mainfrom
kalo/fix-scheduler-wait-flake

Conversation

@KaloyanTanev

Copy link
Copy Markdown
Collaborator

TestSchedulerWait intermittently failed under -race (expected 1, actual 0). After waitBeaconSync advances the fake clock, the slot-ticker goroutine calls clock.After(slot.Time.Sub(clock.Now())) with a non-positive duration for the current slot. A real clockwork clock fires immediately on a non-positive duration, but the test's testClock.Sleep did now.Add(d) unconditionally, rewinding the clock and racing with the test's assertion. Guard testClock.Sleep to be a no-op on non-positive durations, matching real clock semantics.

category: test
ticket: none

@KaloyanTanev KaloyanTanev self-assigned this Sep 28, 2026
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Sep 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.48%. Comparing base (7691f96) to head (b99eb24).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4726      +/-   ##
==========================================
- Coverage   65.49%   65.48%   -0.01%     
==========================================
  Files         246      246              
  Lines       30123    30142      +19     
==========================================
+ Hits        19729    19739      +10     
- Misses      10393    10402       +9     
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants