Parallelize E2E tests to cut CI time in half (#16417)

* Experiment with parallellizing E2E

* Fix lint

* Try parallelism 8

* Apply suggestions from code review

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
feature/default_network_editable
Frederik Bolding 2 years ago committed by GitHub
parent f3efe5a0bd
commit 02088e445d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      .circleci/config.yml
  2. 17
      test/e2e/run-all.js

@ -516,6 +516,7 @@ jobs:
test-e2e-chrome:
executor: node-browsers
parallelism: 8
steps:
- checkout
- run:
@ -543,6 +544,7 @@ jobs:
test-e2e-chrome-mv3:
executor: node-browsers
parallelism: 8
steps:
- checkout
- run:
@ -570,6 +572,7 @@ jobs:
test-e2e-firefox-snaps:
executor: node-browsers
parallelism: 2
steps:
- checkout
- run:
@ -597,6 +600,7 @@ jobs:
test-e2e-chrome-snaps:
executor: node-browsers
parallelism: 2
steps:
- checkout
- run:
@ -624,6 +628,7 @@ jobs:
test-e2e-firefox:
executor: node-browsers-medium-plus
parallelism: 8
steps:
- checkout
- run:

@ -13,6 +13,14 @@ const getTestPathsForTestDir = async (testDir) => {
return testPaths;
};
function chunk(array, chunkSize) {
const result = [];
for (let i = 0; i < array.length; i += chunkSize) {
result.push(array.slice(i, i + chunkSize));
}
return result;
}
async function main() {
const { argv } = yargs(hideBin(process.argv))
.usage(
@ -66,7 +74,14 @@ async function main() {
args.push('--retries', retries);
}
for (const testPath of testPaths) {
// For running E2Es in parallel in CI
const currentChunkIndex = process.env.CIRCLE_NODE_INDEX ?? 0;
const totalChunks = process.env.CIRCLE_NODE_TOTAL ?? 1;
const chunkSize = Math.ceil(testPaths.length / totalChunks);
const chunks = chunk(testPaths, chunkSize);
const currentChunk = chunks[currentChunkIndex];
for (const testPath of currentChunk) {
await runInShell('node', [...args, testPath]);
}
}

Loading…
Cancel
Save