mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 13:51:47 +00:00
try more retries for suspicious tests
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user