Repository navigation
Commit 79e205b
authored
test: Rebalance parallel test scheduling and trim the slowest tests (#1037)
The integration test job grew from ~3.5 min to ~6.3 min when the suite
started running across both built-in HTTP transports. Almost none of
that was extra work: with 806 tests the suite is only 1432
worker-seconds, which is ~90s on 16 workers. The job took 353s because
one worker held the critical path while the other 15 sat idle.
xdist's default `load` scheduler seeds every worker with a chunk of
`items_per_node // 4` consecutive tests and never reassigns them. With
806 tests that chunk is 12, and one worker drew the `test_build.py`
block holding all four variants of `test_build_delete_and_abort` (~87s
each), which it then ran back to back: 88s, 170s, 261s, 350s. Every
other worker was finished by 170s. The same thing happened before the
transport matrix, with 2 variants instead of 4 - so the old 3.5 min was
already this one test.
Three changes:
1. `--dist worksteal` in `addopts`, so an idle worker takes over tests
still queued on a busy one. Measured on the unit suite at identical
concurrency: `1558 passed in 40.65s` -> `1558 passed in 15.58s`.
`--dist` is inert without `-n`, so single-file runs are unaffected.
2. `test_build_delete_and_abort` starts both Actor builds before
awaiting either. `build()` returns as soon as the build is queued, so
the platform can run them concurrently instead of the test serializing
two ~40s builds.
3. `test_request_queue_unlock_requests` polled `list_head` until the
locked IDs disappeared from it, which `list_head` does not reflect - so
every variant burned the full 30s deadline and then discarded the poll
result. It now polls the outcome it cares about, accumulating
`unlocked_count` across `unlock_requests()` calls until all three locks
are accounted for, and asserts that total.
Simulated against the per-test durations reconstructed from the CI logs:
353s -> 100s with change 1 alone, -> 72s with all three.
Change 2 only pays off if the platform builds two versions of the same
Actor concurrently. If it serializes them per Actor the test still
passes, it just stays at ~90s and the job lands nearer 2 min than 1.5.
*✍️ Drafted by Claude Code*1 parent 4aa6eb9 commit 79e205b
3 files changed
Lines changed: 20 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
| 189 | + | |
189 | 190 | | |
190 | 191 | | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | 192 | | |
195 | 193 | | |
| 194 | + | |
| 195 | + | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
| 198 | + | |
| 199 | + | |
199 | 200 | | |
200 | 201 | | |
201 | 202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
573 | 573 | | |
574 | 574 | | |
575 | 575 | | |
576 | | - | |
577 | | - | |
578 | | - | |
| 576 | + | |
| 577 | + | |
579 | 578 | | |
580 | | - | |
581 | 579 | | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
589 | 584 | | |
590 | | - | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
591 | 590 | | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
| 591 | + | |
| 592 | + | |
596 | 593 | | |
597 | 594 | | |
598 | 595 | | |
| |||
0 commit comments