harness: allow overriding the test timeout via env variable

This commit is contained in:
Florian Dold 2023-08-03 21:44:43 +02:00
parent ee47aa4837
commit cf49af2bb9
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -338,8 +338,17 @@ export async function runTests(spec: TestRunSpec) {
currentChild.stdout?.pipe(harnessLogStream); currentChild.stdout?.pipe(harnessLogStream);
currentChild.stderr?.pipe(harnessLogStream); currentChild.stderr?.pipe(harnessLogStream);
const defaultTimeout = 60000; // Default timeout when the test doesn't override it.
const testTimeoutMs = testCase.timeoutMs ?? defaultTimeout; let defaultTimeout = 60000;
const overrideDefaultTimeout = process.env.TALER_TEST_TIMEOUT;
if (overrideDefaultTimeout) {
defaultTimeout = Number.parseInt(overrideDefaultTimeout, 10) * 1000;
}
// Set the timeout to at least be the default timeout.
const testTimeoutMs = testCase.timeoutMs
? Math.max(testCase.timeoutMs, defaultTimeout)
: defaultTimeout;
if (spec.noTimeout) { if (spec.noTimeout) {
console.log(`running ${testName}, no timeout`); console.log(`running ${testName}, no timeout`);