test: give the 10k-iteration sort-key property test its own timeout #318

Merged
fable-5 merged 1 commits from fix/sort-key-test-timeout into main 2026-08-02 14:30:05 +02:00
Showing only changes of commit 78258c4f9b - Show all commits

View File

@ -26,8 +26,15 @@ describe('sort-key helpers (issue #45)', () => {
* pattern repeatedly drop the last page between the first two must never * pattern repeatedly drop the last page between the first two must never
* collide and never overflow the key length, because the caller rebalances * collide and never overflow the key length, because the caller rebalances
* when {@link nextKeyOrRebalance} returns null. * when {@link nextKeyOrRebalance} returns null.
*
* Under parallel CI load the 10.000 iterations have repeatedly exceeded the
* default 5 s per-test timeout (runs 685, 699 same code passed on rerun),
* so this test carries its own budget.
*/ */
it('10.000 adversarial reorders never collide or overflow (rebalance verified)', () => { it(
'10.000 adversarial reorders never collide or overflow (rebalance verified)',
{ timeout: 30_000 },
() => {
// Start with five pages in a fixed order. // Start with five pages in a fixed order.
let order = evenlySpacedKeys(5).map((key, i) => ({ id: `p${i}`, key })); let order = evenlySpacedKeys(5).map((key, i) => ({ id: `p${i}`, key }));
let rebalances = 0; let rebalances = 0;
@ -69,5 +76,6 @@ describe('sort-key helpers (issue #45)', () => {
// The adversarial pattern must have forced at least one rebalance. // The adversarial pattern must have forced at least one rebalance.
expect(rebalances).toBeGreaterThan(0); expect(rebalances).toBeGreaterThan(0);
}); },
);
}); });