Skip to content

Commit 6ad1f00

Browse files
Prithvi-Webclaude
andcommitted
test(store): the eight-worker walk is taken again until two workers are counted at once - GitHub's Windows runner ran its eight workers one after another once (134674f: "the second walk ran on 1 workers at once"), on a small tree and three busy cores, so the check read the machine's scheduling, not TreeMap; up to five tries, counted, not timed, and the answers are compared against a walk that really ran in parallel (mutant maxWorkers 1: "ran on 1, 1, 1, 1, 1 workers at once in 5 of 5 tries")
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent c42d3c2 commit 6ad1f00

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎tests/numberingIndependence.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,14 +858,22 @@ test('one worker and eight workers give the same answers for the same tree', asy
858858
applyEngineBudgetSetting({ preset: 'turbo', cpuPercent: null });
859859
let one: { scan: ScanResult; store: PackedScanStore };
860860
let eight: { scan: ScanResult; store: PackedScanStore };
861+
// Eight workers allowed is not eight at once: on a small tree and a busy
862+
// three-core runner the system can run them one after another (GitHub's
863+
// Windows runner did, once, at 134674f6). So the eight-worker walk is taken
864+
// again, up to five times, until two workers were counted at once, and the
865+
// answers below are compared against a walk that really ran in parallel.
866+
// Counted, not timed.
867+
const TRIES = 5;
861868
try {
862869
one = await walk(1);
863870
eight = await walk(8);
871+
for (let tried = 1; peaks[peaks.length - 1] < 2 && tried < TRIES; tried++) eight = await walk(8);
864872
} finally {
865873
applyEngineBudgetSetting({ preset: 'auto', cpuPercent: null });
866874
}
867875
assert.equal(peaks[0], 1, 'the first walk ran on one worker');
868-
assert.ok(peaks[1] >= 2, `the second walk ran on ${peaks[1]} workers at once`);
876+
assert.ok(peaks[peaks.length - 1] >= 2, `the eight-worker walk ran on ${peaks.slice(1).join(', ')} workers at once in ${peaks.length - 1} of ${TRIES} tries`);
869877

870878
const counters = (scan: ScanResult): unknown => [
871879
scan.scanned, scan.fileCount, scan.dirCount, scan.hardlinkedFiles, scan.hardlinkedBytes, scan.sparseFiles, scan.sparseBytes,

0 commit comments

Comments
 (0)