mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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:
@@ -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: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user