This commit is contained in:
Mathias Leppich 2024-09-09 15:29:43 +02:00
parent 7ea1506799
commit 8d485f58b9

View file

@ -217,7 +217,7 @@ function filterForShardRoundRobin(
return group.tests.reduce((sum, test) => sum + Math.max(1, lastRunInfo.testDurations?.[test.id] || averageDuration), 0); return group.tests.reduce((sum, test) => sum + Math.max(1, lastRunInfo.testDurations?.[test.id] || averageDuration), 0);
}; };
// We sort the test groups by the number of tests in descending order. // We sort the test groups by group duration in descending order.
const sortedTestGroups = testGroups.slice().sort((a, b) => weight(b) - weight(a)); const sortedTestGroups = testGroups.slice().sort((a, b) => weight(b) - weight(a));
// Then we add each group to the shard with the smallest number of tests. // Then we add each group to the shard with the smallest number of tests.