Commit 35f7c74
committed
test: replace time.Sleep with require.Eventually in health integration test
Replace fixed duration time.Sleep calls with require.Eventually polling
to make the health endpoint integration test more robust and less flaky.
Changes:
- Use require.Eventually to poll for health state transitions
- Poll every 100ms instead of fixed sleeps
- Generous timeouts (5s and 10s) that terminate early on success
- Better error handling during polling
Benefits:
- More resilient to timing variations in CI/CD environments
- Faster test execution (completes as soon as conditions are met)
- Eliminates magic numbers (1700ms compensation)
- Expresses intent clearly (wait until condition is met)
- Non-flaky (tested 3x consecutively)1 parent f9abded commit 35f7c74
1 file changed
Lines changed: 19 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
484 | 488 | | |
485 | 489 | | |
486 | 490 | | |
| |||
0 commit comments