Fix flaky BeLessThanOrEqualTo execution time test#3200
Conversation
…limit Agent-Logs-Url: https://github.com/fluentassertions/fluentassertions/sessions/6963d932-6650-4e1b-9044-47692ab4a27f Co-authored-by: dennisdoomen <572734+dennisdoomen@users.noreply.github.com>
dennisdoomen
left a comment
There was a problem hiding this comment.
@copilot do a thorough investigation to see why this test is flaky. Is it the test itself or is it the implementation of the assertion API in FA
Here's the full analysis: The implementation is correct. The flakiness was entirely in the test. How the timing path works
Why it was flakyThe
With a 1-second limit and a 100ms sleep, there's nominally 900ms of slack. But under CI load, Why the fix is correctThe equivalent |
Test Results 37 files ±0 37 suites ±0 2m 56s ⏱️ +20s Results for commit c784841. ± Comparison against base commit 79050a9. This pull request removes 10 and adds 8 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
Coverage Report for CI Build 24835291706Coverage remained the same at 97.172%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
Qodana for .NETIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at qodana-support@jetbrains.com
|
Thread.Sleep(100)only guarantees a minimum sleep duration — on a loaded CI runner, the OS scheduler can delay wakeup well beyond 100ms, causing the 1-second limit to be exceeded intermittently.BeLessThanOrEqualTo"should not throw" test limit from1.Seconds()to2.Seconds(), aligning it with the identical setup in theBeLessThanequivalent test which already uses that margin.