diff --git a/tests/boundary/filesystem/ciTestSequencer.test.ts b/tests/boundary/filesystem/ciTestSequencer.test.ts index 452bfae0e4..502e0c04b1 100644 --- a/tests/boundary/filesystem/ciTestSequencer.test.ts +++ b/tests/boundary/filesystem/ciTestSequencer.test.ts @@ -235,3 +235,13 @@ describe("duration shard allocation", () => { ).toBe(300); }); }); + +it("uses both shards when equal files fit into spare workers in one shard", () => { + const items = ["a", "b"].map((key) => ({ + item: key, + key, + duration: 20, + laneWidth: 2, + })); + expect(allocateByDuration(items, 2)).toEqual([["a"], ["b"]]); +}); diff --git a/tests/ciTestSequencer.ts b/tests/ciTestSequencer.ts index ec80212b67..945762f6a1 100644 --- a/tests/ciTestSequencer.ts +++ b/tests/ciTestSequencer.ts @@ -181,7 +181,10 @@ export function allocateByDuration( for (const candidate of shards.slice(1)) { const phases = place(candidate.phases, entry, duration); const wall = wallOf(phases); - if (wall < chosenWall) { + if ( + wall < chosenWall || + (wall === chosenWall && candidate.items.length < chosen.items.length) + ) { chosen = candidate; chosenPhases = phases; chosenWall = wall;