Commit bbe21b0
test: fix flaky TestStatusHandler_RecentRepos_FailureHasErrorFields (#24)
The test waited on `len(RecentRepos) > 0`, but a repo is tracked (and thus
present in RecentRepos) as soon as processing starts — before the handler
returns and the queue records last_error/last_error_time. Under load the status
snapshot could be read in that window, so `last_error` came back empty.
Wait on the actual recorded signal instead: `RecentRepos[0].LastError != ""`
for the failure test, and `!RecentRepos[0].LastSuccessTime.IsZero()` for the
sibling success test (TestStatusHandler_ReportsPerRepoRecentRepos), which had
the same latent race against `last_success_time`.
Reproduced reliably with `-race`; fixed test now passes 40x under `-race`.
Production sync-queue code is unchanged.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent cd6877d commit bbe21b0
1 file changed
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
| 376 | + | |
| 377 | + | |
376 | 378 | | |
377 | | - | |
| 379 | + | |
| 380 | + | |
378 | 381 | | |
379 | 382 | | |
380 | 383 | | |
| |||
434 | 437 | | |
435 | 438 | | |
436 | 439 | | |
| 440 | + | |
| 441 | + | |
437 | 442 | | |
438 | | - | |
| 443 | + | |
| 444 | + | |
439 | 445 | | |
440 | 446 | | |
441 | 447 | | |
| |||
0 commit comments