Skip to content

Commit

Permalink
Merge pull request #49649 from margelo/e2e/handle-warmup-exceptions
Browse files Browse the repository at this point in the history
[NoQA] e2e: allow warmup failures
  • Loading branch information
mountiny authored Oct 1, 2024
2 parents 76c5c81 + 9405e5a commit 28bc3cd
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions tests/e2e/testRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,35 @@ const runTests = async (): Promise<void> => {

const warmupText = `Warmup for test '${test.name}' [${testIndex + 1}/${tests.length}]`;

// For each warmup we allow the warmup to fail three times before we stop the warmup run:
const errorCountWarmupRef = {
errorCount: 0,
allowedExceptions: 3,
};

// by default we do 2 warmups:
// - first warmup to pass a login flow
// - second warmup to pass an actual flow and cache network requests
const iterations = 2;
for (let i = 0; i < iterations; i++) {
// Warmup the main app:
await runTestIteration(config.MAIN_APP_PACKAGE, `[MAIN] ${warmupText}. Iteration ${i + 1}/${iterations}`, config.BRANCH_MAIN);
try {
// Warmup the main app:
await runTestIteration(config.MAIN_APP_PACKAGE, `[MAIN] ${warmupText}. Iteration ${i + 1}/${iterations}`, config.BRANCH_MAIN);

// Warmup the delta app:
await runTestIteration(config.DELTA_APP_PACKAGE, `[DELTA] ${warmupText}. Iteration ${i + 1}/${iterations}`, config.BRANCH_DELTA);
} catch (e) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
Logger.error(`Warmup failed with error: ${e}`);

errorCountWarmupRef.errorCount++;
i--; // repeat warmup again

// Warmup the delta app:
await runTestIteration(config.DELTA_APP_PACKAGE, `[DELTA] ${warmupText}. Iteration ${i + 1}/${iterations}`, config.BRANCH_DELTA);
if (errorCountWarmupRef.errorCount === errorCountWarmupRef.allowedExceptions) {
Logger.error("There was an error running the warmup and we've reached the maximum number of allowed exceptions. Stopping the test run.");
throw e;
}
}
}

server.setReadyToAcceptTestResults(true);
Expand Down

0 comments on commit 28bc3cd

Please sign in to comment.