Fix flaky test - #3231
Fix flaky test#3231
Conversation
Fix flaky test if there's a race in the shared pool between parallel test executions.
There was a problem hiding this comment.
🟡 Changes recommended
The FakeTimeProvider assertion will fail deterministically on .NET 8+ until corrected.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This pull request isolates cancellation-token pool tests from the shared process-wide pool to prevent race-related flakiness.
Changes:
- Uses a dedicated pool for reusable-pool tests.
- Exposes the pooled implementation internally for testing.
- The
FakeTimeProviderreuse assertion still needs correction.
File summaries
| File | Summary |
|---|---|
test/Polly.Core.Tests/Utils/CancellationTokenSourcePoolTests.cs |
Uses an isolated pool but contains an incorrect reuse assertion on pooled targets. |
src/Polly.Core/Utils/CancellationTokenSourcePool.Pooled.cs |
Enables internal construction of the pooled implementation for tests. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3231 +/- ##
=======================================
Coverage 98.02% 98.02%
=======================================
Files 321 321
Lines 7099 7099
Branches 1089 1089
=======================================
Hits 6959 6959
Misses 98 98
Partials 42 42
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Fix flaky test if there's a race in the shared pool between parallel test executions.