try more retries for suspicious tests

This commit is contained in:
Ben Grant
2025-06-02 16:15:32 -07:00
parent ce175ac95e
commit fe8dfee059

View File

@@ -313,7 +313,7 @@ async function runTests() {
const okResults = [];
const flakyResults = [];
const failedResults = [];
const maxAttempts = 1 + (parseInt(options["retries"]) || 0);
const defaultMaxAttempts = 1 + (parseInt(options["retries"]) || 0);
/**
* @param {string} title
@@ -321,11 +321,23 @@ async function runTests() {
* @returns {Promise<TestResult>}
*/
const runTest = async (title, fn) => {
// suspicious tests are run a minimum number of times, larger than the normal retry count, even
// if they pass on the first attempt. we are giving them N chances to fail instead of N chances
// to pass.
const suspiciousTests = [
"test-worker-arraybuffer-zerofill.js",
"worker_destruction.test.ts",
"worker.test.ts",
"test-worker-message-port-transfer-terminate.js",
"worker-lifecycle-message-port.test.ts",
];
const suspicious = suspiciousTests.some(name => title.includes(name));
const maxAttempts = suspicious ? 50 : defaultMaxAttempts;
const index = ++i;
let result, failure, flaky;
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
if (attempt > 1) {
if (attempt > 1 && !suspicious) {
await new Promise(resolve => setTimeout(resolve, 5000 + Math.random() * 10_000));
}
@@ -343,7 +355,11 @@ async function runTests() {
} else {
okResults.push(result);
}
break;
if (suspicious) {
continue;
} else {
break;
}
}
const color = attempt >= maxAttempts ? "red" : "yellow";