consistent sharding logic when no shards file (#1710)

This commit is contained in:
Moshe Brodsky
2026-06-12 22:19:30 +03:00
committed by GitHub
parent d393799d2a
commit 932f8bcc07

View File

@ -139,7 +139,8 @@ final class Shard implements AddsOutput, HandlesArguments, Terminable
self::$timeBalanced = true;
self::$shardsOutdated = $newTests !== [];
} else {
$testsToRun = (array_chunk($tests, max(1, (int) ceil(count($tests) / $total))))[$index - 1] ?? [];
$isInCurrentShard = fn (int $key) => $key % $total === ($index - 1);
$testsToRun = array_values(array_filter(array_values($tests), $isInCurrentShard, ARRAY_FILTER_USE_KEY));
}
self::$shard = [