Commit 40a6d1a
authored
test: stabilize four flakes surfaced by the CI Stress workflow (#193)
Run https://github.com/microsoft/microsoft-ui-reactor/actions/runs/25504721012
turned up 17 iteration failures across 200 iterations, concentrated
in six tests. This commit addresses all six.
Unit tests (timing budgets that were tight for a starved CI runner):
- UseResourceTests.Retry_Invokes_Fetcher_Multiple_Times_And_Settles_On_Success
and Retry_Exhausted_Surfaces_Final_Error: bump the poll budget from
5s to 30s. Retry uses a 100ms/200ms backoff and threadpool/timer
callbacks for re-attempts; on a contended CI runner the third
attempt routinely landed past the 5s ceiling, surfacing as either
Expected:3 Actual:2 (third call hadn't fired) or
Expected:Data Actual:Loading (state hadn't transitioned).
- LogCaptureBufferTests.WaitForNewAsync_RespectsTimeout: relax the
upper bound on a 150ms wait from 2s to 30s. The lower bound is the
meaningful check (timeout was honored); the upper bound is just a
"didn't get stuck forever" sanity guard, and 2s was tight enough
that a thread-pool stall could blow it (observed 3070ms on CI).
- AutoSuggestTests.WaitForState helper: bump WaitAsync from 5s to 30s.
Same shape — debounce + worker continuation can land past 5s when
the threadpool is starved; both Empty_State_On_No_Results and
Error_State_On_Exception failed with TimeoutException at 10–12s.
Selftests (one real race, one too-strict bound, both with weak diagnostics):
- ThreadSafe_RapidBackgroundSetState: real bug. The 2-second
CancellationTokenSource started ticking before Task.Run actually
scheduled the four worker threads, so on a starved threadpool the
budget could elapse before any worker hit the loop, leaving
writeCount at 0 and the rendered counter never updating. Switch to
Barrier(5) (4 workers + main) so the main thread waits for all
workers to be inside the loop before calling cts.CancelAfter(2s).
Also include writeCount and rendered in the Check messages so
future regressions are diagnosable from the log.
- ThreadSafe_RenderCoalescing: relax the bound from renders<100 to
renders<200, and include the actual count in the Check message.
100 was too aggressive — under threadpool starvation the UI thread
can sneak in renders between the background-thread setState calls,
and the production coalescing logic is what we're probing, not the
CI scheduler. 200 still detects "no coalescing at all" while
tolerating realistic interleaving (full coalescing on a quiet
machine produces ~2 renders).
All five formerly-flaky unit tests pass locally after the change.1 parent 0bbfe72 commit 40a6d1a
4 files changed
Lines changed: 29 additions & 12 deletions
File tree
- tests
- Reactor.AppTests.Host/SelfTest/Fixtures
- Reactor.Tests
- Core
- Devtools
Lines changed: 16 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
51 | 53 | | |
52 | | - | |
| 54 | + | |
| 55 | + | |
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
| |||
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
| 69 | + | |
| 70 | + | |
66 | 71 | | |
67 | 72 | | |
68 | 73 | | |
| |||
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
74 | | - | |
| 79 | + | |
75 | 80 | | |
76 | 81 | | |
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
80 | 85 | | |
81 | | - | |
| 86 | + | |
82 | 87 | | |
83 | 88 | | |
84 | 89 | | |
| |||
292 | 297 | | |
293 | 298 | | |
294 | 299 | | |
295 | | - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
296 | 305 | | |
297 | 306 | | |
298 | 307 | | |
299 | 308 | | |
300 | 309 | | |
301 | | - | |
| 310 | + | |
302 | 311 | | |
303 | 312 | | |
304 | 313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
294 | | - | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
295 | 297 | | |
296 | 298 | | |
297 | 299 | | |
| |||
324 | 326 | | |
325 | 327 | | |
326 | 328 | | |
327 | | - | |
| 329 | + | |
| 330 | + | |
328 | 331 | | |
329 | 332 | | |
330 | | - | |
| 333 | + | |
331 | 334 | | |
332 | 335 | | |
333 | 336 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
136 | 138 | | |
137 | 139 | | |
138 | 140 | | |
| |||
0 commit comments