Commit 8511b2e3 authored by Albert Salim's avatar Albert Salim

Sort tests by path before before distributing to nodes

The `tests` parameter may not be sorted in the same way across nodes,
so we need to sort them first before distributing the tests.
parent 66253386
......@@ -8,14 +8,27 @@ class ParallelCISequencer extends Sequencer {
}
sort(tests) {
const testsForThisRunner = this.distributeAcrossCINodes(tests);
const sortedTests = this.sortByPath(tests);
const testsForThisRunner = this.distributeAcrossCINodes(sortedTests);
console.log(`CI_NODE_INDEX: ${this.ciNodeIndex}`);
console.log(`CI_NODE_TOTAL: ${this.ciNodeTotal}`);
console.log(`Total number of tests: ${tests.length}`);
console.log(`Total number of tests for this runner: ${testsForThisRunner.length}`);
return super.sort(testsForThisRunner);
return testsForThisRunner;
}
sortByPath(tests) {
return tests.sort((test1, test2) => {
if (test1.path < test2.path) {
return -1;
}
if (test1.path > test2.path) {
return 1;
}
return 0;
});
}
distributeAcrossCINodes(tests) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment