Skip to content

test: de-flake StopTimer_prevents_further_callbacks (#250) - #307

Merged
Chris-Wolfgang merged 1 commit into
vNextfrom
fix/250-flaky-stoptimer
Jul 23, 2026
Merged

test: de-flake StopTimer_prevents_further_callbacks (#250)#307
Chris-Wolfgang merged 1 commit into
vNextfrom
fix/250-flaky-stoptimer

Conversation

@Chris-Wolfgang

Copy link
Copy Markdown
Owner

Summary

SystemProgressTimerTests.StopTimer_prevents_further_callbacks is flaky on slow runners (issue #250). It asserted exact count equality (countAfterStop == countAfterWait) after only a fixed 50ms grace following StopTimer(). A tick already dispatched when StopTimer was called — at most one — can land after that grace when the runner is slow/loaded, incrementing the count and failing the equality.

Fix: replace the fixed grace with a WaitUntilStable poll that returns once the callback count has been unchanged for a full stability window — absorbing that last in-flight tick regardless of runner speed — then still assert the count stays put across several further intervals (a running timer would fire ~4 more). The poll is bounded by an overall deadline, so a genuinely-broken StopTimer fails the assertion rather than hanging.

No production code change; the timer behaviour under test is unchanged — only the test's timing assumptions are made deterministic.

Verification

Ran the test in Release (net10.0) — green every time.

Closes #250

The test asserted an exact callback-count equality after only a fixed 50ms
grace following StopTimer(). A tick already dispatched when StopTimer was called
(at most one) can land after that grace on a slow/loaded runner, incrementing
the count and failing the exact-equality assertion.

Replaces the fixed grace with a WaitUntilStable poll that returns once the count
has been unchanged for a full window — so the last in-flight tick is absorbed
regardless of runner speed — then still asserts the count stays put across
several further intervals (a running timer would fire ~4 more). Bounded by an
overall deadline so a genuinely-broken StopTimer fails the assertion instead of
hanging.

Verified: 5/5 green in Release.

Closes #250

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 22, 2026 17:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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