Repository navigation
Fix flaky test_cancel_optimization - #8159
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a flaky test test_cancel_optimization that was failing intermittently on Windows. The test was asserting an exact count of logged optimizations, but optimizations that are cancelled very early (before they successfully start) are intentionally excluded from the log to avoid clutter. The fix relaxes the assertion from strict equality to a less-than-or-equal comparison.
Changes:
- Changed assertion from
assert_eq!(log.len(), expected_optimization_count)toassert!(log.len() <= expected_optimization_count)to account for early-cancelled optimizations not being logged
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I'm not confident yet this change is correct. Are cancellations even relevant here? Don't they follow up with a new optimization to still satisfy that count assertion? |
No retry here. The test calls I considered polling for the log to be populated, but went with the smaller fix since the name + status assertions still cover every entry that makes it into the log. The race only drops entries, never produces false ones. |
timvisee
left a comment
There was a problem hiding this comment.
Thank you for tackling this one! 😄
Co-authored-by: leohenon <[email protected]>
Co-authored-by: leohenon <[email protected]>
Relax log count assertion from
assert_eq!to<=.Early cancellations are intentionally excluded from log (
optimization_worker.rs:376).Fixes #7794
All Submissions:
devbranch. Did you create your branch fromdev?