chore: retry failing tests in CI (#17681)

This PR introduces failing test retries in CI for e2e tests, Go tests
with the in-memory database, Go tests with Postgres, and the CLI tests.
Retries are not enabled for race tests.

The goal is to reduce how often flakes disrupt developers' workflows.
This commit is contained in:
Hugo Dutka
2025-05-06 16:53:26 +02:00
committed by GitHub
parent d9b00e4849
commit a7e828593f
3 changed files with 35 additions and 5 deletions
+18
View File
@@ -10,12 +10,30 @@ import {
} from "./constants";
export const wsEndpoint = process.env.CODER_E2E_WS_ENDPOINT;
export const retries = (() => {
if (process.env.CODER_E2E_TEST_RETRIES === undefined) {
return undefined;
}
const count = Number.parseInt(process.env.CODER_E2E_TEST_RETRIES, 10);
if (Number.isNaN(count)) {
throw new Error(
`CODER_E2E_TEST_RETRIES is not a number: ${process.env.CODER_E2E_TEST_RETRIES}`,
);
}
if (count < 0) {
throw new Error(
`CODER_E2E_TEST_RETRIES is less than 0: ${process.env.CODER_E2E_TEST_RETRIES}`,
);
}
return count;
})();
const localURL = (port: number, path: string): string => {
return `http://localhost:${port}${path}`;
};
export default defineConfig({
retries,
globalSetup: require.resolve("./setup/preflight"),
projects: [
{