timeout for tests
This commit is contained in:
parent
c0904936e4
commit
aefc3f26b6
@ -44,11 +44,12 @@
|
|||||||
"typescript": "^4.1.3"
|
"typescript": "^4.1.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@gnu-taler/taler-wallet-core": "workspace:*",
|
||||||
"@types/minimatch": "^3.0.3",
|
"@types/minimatch": "^3.0.3",
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
|
"cancellationtoken": "^2.2.0",
|
||||||
"minimatch": "^3.0.4",
|
"minimatch": "^3.0.4",
|
||||||
"source-map-support": "^0.5.19",
|
"source-map-support": "^0.5.19",
|
||||||
"@gnu-taler/taler-wallet-core": "workspace:*",
|
|
||||||
"tslib": "^2.1.0"
|
"tslib": "^2.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,10 +98,14 @@ import {
|
|||||||
import { ApplyRefundResponse } from "@gnu-taler/taler-wallet-core";
|
import { ApplyRefundResponse } from "@gnu-taler/taler-wallet-core";
|
||||||
import { PendingOperationsResponse } from "@gnu-taler/taler-wallet-core";
|
import { PendingOperationsResponse } from "@gnu-taler/taler-wallet-core";
|
||||||
import { CoinConfig } from "./denomStructures";
|
import { CoinConfig } from "./denomStructures";
|
||||||
|
import CancellationToken from "cancellationtoken";
|
||||||
|
|
||||||
const exec = util.promisify(require("child_process").exec);
|
const exec = util.promisify(require("child_process").exec);
|
||||||
|
|
||||||
export async function delayMs(ms: number): Promise<void> {
|
export async function delayMs(
|
||||||
|
ms: number,
|
||||||
|
cancellationToken?: CancellationToken,
|
||||||
|
): Promise<void> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
setTimeout(() => resolve(), ms);
|
setTimeout(() => resolve(), ms);
|
||||||
});
|
});
|
||||||
@ -1486,6 +1490,8 @@ export interface TestRunResult {
|
|||||||
timeSec: number;
|
timeSec: number;
|
||||||
|
|
||||||
status: TestStatus;
|
status: TestStatus;
|
||||||
|
|
||||||
|
reason?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function runTestWithState(
|
export async function runTestWithState(
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
delayMs,
|
||||||
GlobalTestState,
|
GlobalTestState,
|
||||||
runTestWithState,
|
runTestWithState,
|
||||||
shouldLingerInTest,
|
shouldLingerInTest,
|
||||||
@ -56,6 +57,7 @@ import { runMerchantExchangeConfusionTest } from "./test-merchant-exchange-confu
|
|||||||
import { runLibeufinBasicTest } from "./test-libeufin-basic";
|
import { runLibeufinBasicTest } from "./test-libeufin-basic";
|
||||||
import { runLibeufinTutorialTest } from "./test-libeufin-tutorial";
|
import { runLibeufinTutorialTest } from "./test-libeufin-tutorial";
|
||||||
import { runDepositTest } from "./test-deposit";
|
import { runDepositTest } from "./test-deposit";
|
||||||
|
import CancellationToken from "cancellationtoken";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test runner.
|
* Test runner.
|
||||||
@ -201,30 +203,64 @@ export async function runTests(spec: TestRunSpec) {
|
|||||||
currentChild.stdout?.pipe(harnessLogStream);
|
currentChild.stdout?.pipe(harnessLogStream);
|
||||||
currentChild.stderr?.pipe(harnessLogStream);
|
currentChild.stderr?.pipe(harnessLogStream);
|
||||||
|
|
||||||
const result: TestRunResult = await new Promise((resolve, reject) => {
|
const testTimeoutMs = 60000;
|
||||||
let msg: TestRunResult | undefined;
|
|
||||||
currentChild!.on("message", (m) => {
|
const { token } = CancellationToken.timeout(60000);
|
||||||
msg = m as TestRunResult;
|
|
||||||
});
|
const resultPromise: Promise<TestRunResult> = new Promise(
|
||||||
currentChild!.on("exit", (code, signal) => {
|
(resolve, reject) => {
|
||||||
if (signal) {
|
let msg: TestRunResult | undefined;
|
||||||
reject(new Error(`test worker exited with signal ${signal}`));
|
currentChild!.on("message", (m) => {
|
||||||
} else if (code != 0) {
|
if (token.isCancelled) {
|
||||||
reject(new Error(`test worker exited with code ${code}`));
|
return;
|
||||||
} else if (!msg) {
|
}
|
||||||
reject(
|
msg = m as TestRunResult;
|
||||||
new Error(
|
});
|
||||||
`test worker exited without giving back the test results`,
|
currentChild!.on("exit", (code, signal) => {
|
||||||
),
|
if (token.isCancelled) {
|
||||||
);
|
return;
|
||||||
} else {
|
}
|
||||||
resolve(msg);
|
if (signal) {
|
||||||
}
|
reject(new Error(`test worker exited with signal ${signal}`));
|
||||||
});
|
} else if (code != 0) {
|
||||||
currentChild!.on("error", (err) => {
|
reject(new Error(`test worker exited with code ${code}`));
|
||||||
reject(err);
|
} else if (!msg) {
|
||||||
});
|
reject(
|
||||||
});
|
new Error(
|
||||||
|
`test worker exited without giving back the test results`,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
resolve(msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
currentChild!.on("error", (err) => {
|
||||||
|
if (token.isCancelled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
let result: TestRunResult;
|
||||||
|
|
||||||
|
try {
|
||||||
|
result = await token.racePromise(resultPromise);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`test ${testName} timed out`);
|
||||||
|
if (token.isCancelled) {
|
||||||
|
result = {
|
||||||
|
status: "fail",
|
||||||
|
reason: "timeout",
|
||||||
|
timeSec: testTimeoutMs / 1000,
|
||||||
|
name: testName,
|
||||||
|
};
|
||||||
|
currentChild.kill("SIGTERM");
|
||||||
|
} else {
|
||||||
|
throw Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
harnessLogStream.close();
|
harnessLogStream.close();
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ importers:
|
|||||||
rollup-plugin-terser: 7.0.2_rollup@2.37.1
|
rollup-plugin-terser: 7.0.2_rollup@2.37.1
|
||||||
typescript: 4.1.3
|
typescript: 4.1.3
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@gnu-taler/taler-wallet-core': workspace:*
|
||||||
'@rollup/plugin-commonjs': ^17.0.0
|
'@rollup/plugin-commonjs': ^17.0.0
|
||||||
'@rollup/plugin-json': ^4.1.0
|
'@rollup/plugin-json': ^4.1.0
|
||||||
'@rollup/plugin-node-resolve': ^11.1.0
|
'@rollup/plugin-node-resolve': ^11.1.0
|
||||||
@ -58,16 +59,16 @@ importers:
|
|||||||
rollup: ^2.37.1
|
rollup: ^2.37.1
|
||||||
rollup-plugin-sourcemaps: ^0.6.3
|
rollup-plugin-sourcemaps: ^0.6.3
|
||||||
rollup-plugin-terser: ^7.0.2
|
rollup-plugin-terser: ^7.0.2
|
||||||
'@gnu-taler/taler-wallet-core': workspace:*
|
|
||||||
tslib: ^2.1.0
|
tslib: ^2.1.0
|
||||||
typescript: ^4.1.3
|
typescript: ^4.1.3
|
||||||
packages/taler-wallet-cli:
|
packages/taler-wallet-cli:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@gnu-taler/taler-wallet-core': link:../taler-wallet-core
|
||||||
'@types/minimatch': 3.0.3
|
'@types/minimatch': 3.0.3
|
||||||
axios: 0.21.1
|
axios: 0.21.1
|
||||||
|
cancellationtoken: 2.2.0
|
||||||
minimatch: 3.0.4
|
minimatch: 3.0.4
|
||||||
source-map-support: 0.5.19
|
source-map-support: 0.5.19
|
||||||
'@gnu-taler/taler-wallet-core': link:../taler-wallet-core
|
|
||||||
tslib: 2.1.0
|
tslib: 2.1.0
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@rollup/plugin-commonjs': 17.0.0_rollup@2.37.1
|
'@rollup/plugin-commonjs': 17.0.0_rollup@2.37.1
|
||||||
@ -83,6 +84,7 @@ importers:
|
|||||||
typedoc: 0.20.16_typescript@4.1.3
|
typedoc: 0.20.16_typescript@4.1.3
|
||||||
typescript: 4.1.3
|
typescript: 4.1.3
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@gnu-taler/taler-wallet-core': workspace:*
|
||||||
'@rollup/plugin-commonjs': ^17.0.0
|
'@rollup/plugin-commonjs': ^17.0.0
|
||||||
'@rollup/plugin-json': ^4.1.0
|
'@rollup/plugin-json': ^4.1.0
|
||||||
'@rollup/plugin-node-resolve': ^11.1.0
|
'@rollup/plugin-node-resolve': ^11.1.0
|
||||||
@ -90,6 +92,7 @@ importers:
|
|||||||
'@types/minimatch': ^3.0.3
|
'@types/minimatch': ^3.0.3
|
||||||
'@types/node': ^14.14.22
|
'@types/node': ^14.14.22
|
||||||
axios: ^0.21.1
|
axios: ^0.21.1
|
||||||
|
cancellationtoken: ^2.2.0
|
||||||
minimatch: ^3.0.4
|
minimatch: ^3.0.4
|
||||||
prettier: ^2.2.1
|
prettier: ^2.2.1
|
||||||
rimraf: ^3.0.2
|
rimraf: ^3.0.2
|
||||||
@ -97,21 +100,21 @@ importers:
|
|||||||
rollup-plugin-sourcemaps: ^0.6.3
|
rollup-plugin-sourcemaps: ^0.6.3
|
||||||
rollup-plugin-terser: ^7.0.2
|
rollup-plugin-terser: ^7.0.2
|
||||||
source-map-support: ^0.5.19
|
source-map-support: ^0.5.19
|
||||||
'@gnu-taler/taler-wallet-core': workspace:*
|
|
||||||
tslib: ^2.1.0
|
tslib: ^2.1.0
|
||||||
typedoc: ^0.20.16
|
typedoc: ^0.20.16
|
||||||
typescript: ^4.1.3
|
typescript: ^4.1.3
|
||||||
packages/taler-wallet-core:
|
packages/taler-wallet-core:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@gnu-taler/idb-bridge': link:../idb-bridge
|
||||||
'@types/node': 14.14.22
|
'@types/node': 14.14.22
|
||||||
axios: 0.21.1
|
axios: 0.21.1
|
||||||
big-integer: 1.6.48
|
big-integer: 1.6.48
|
||||||
fflate: 0.6.0
|
fflate: 0.6.0
|
||||||
'@gnu-taler/idb-bridge': link:../idb-bridge
|
|
||||||
source-map-support: 0.5.19
|
source-map-support: 0.5.19
|
||||||
tslib: 2.1.0
|
tslib: 2.1.0
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@ava/typescript': 1.1.1
|
'@ava/typescript': 1.1.1
|
||||||
|
'@gnu-taler/pogen': link:../pogen
|
||||||
'@microsoft/api-extractor': 7.13.0
|
'@microsoft/api-extractor': 7.13.0
|
||||||
'@typescript-eslint/eslint-plugin': 4.14.0_980e7d90d2d08155204a38366bd3b934
|
'@typescript-eslint/eslint-plugin': 4.14.0_980e7d90d2d08155204a38366bd3b934
|
||||||
'@typescript-eslint/parser': 4.14.0_eslint@7.18.0+typescript@4.1.3
|
'@typescript-eslint/parser': 4.14.0_eslint@7.18.0+typescript@4.1.3
|
||||||
@ -126,7 +129,6 @@ importers:
|
|||||||
jed: 1.1.1
|
jed: 1.1.1
|
||||||
nyc: 15.1.0
|
nyc: 15.1.0
|
||||||
po2json: 0.4.5
|
po2json: 0.4.5
|
||||||
'@gnu-taler/pogen': link:../pogen
|
|
||||||
prettier: 2.2.1
|
prettier: 2.2.1
|
||||||
rimraf: 3.0.2
|
rimraf: 3.0.2
|
||||||
rollup: 2.37.1
|
rollup: 2.37.1
|
||||||
@ -136,6 +138,8 @@ importers:
|
|||||||
typescript: 4.1.3
|
typescript: 4.1.3
|
||||||
specifiers:
|
specifiers:
|
||||||
'@ava/typescript': ^1.1.1
|
'@ava/typescript': ^1.1.1
|
||||||
|
'@gnu-taler/idb-bridge': workspace:*
|
||||||
|
'@gnu-taler/pogen': workspace:*
|
||||||
'@microsoft/api-extractor': ^7.13.0
|
'@microsoft/api-extractor': ^7.13.0
|
||||||
'@types/node': ^14.14.22
|
'@types/node': ^14.14.22
|
||||||
'@typescript-eslint/eslint-plugin': ^4.14.0
|
'@typescript-eslint/eslint-plugin': ^4.14.0
|
||||||
@ -151,11 +155,9 @@ importers:
|
|||||||
eslint-plugin-react-hooks: ^4.2.0
|
eslint-plugin-react-hooks: ^4.2.0
|
||||||
esm: ^3.2.25
|
esm: ^3.2.25
|
||||||
fflate: ^0.6.0
|
fflate: ^0.6.0
|
||||||
'@gnu-taler/idb-bridge': workspace:*
|
|
||||||
jed: ^1.1.1
|
jed: ^1.1.1
|
||||||
nyc: ^15.1.0
|
nyc: ^15.1.0
|
||||||
po2json: ^0.4.5
|
po2json: ^0.4.5
|
||||||
'@gnu-taler/pogen': workspace:*
|
|
||||||
prettier: ^2.2.1
|
prettier: ^2.2.1
|
||||||
rimraf: ^3.0.2
|
rimraf: ^3.0.2
|
||||||
rollup: ^2.37.1
|
rollup: ^2.37.1
|
||||||
@ -167,8 +169,8 @@ importers:
|
|||||||
typescript: ^4.1.3
|
typescript: ^4.1.3
|
||||||
packages/taler-wallet-webextension:
|
packages/taler-wallet-webextension:
|
||||||
dependencies:
|
dependencies:
|
||||||
moment: 2.29.1
|
|
||||||
'@gnu-taler/taler-wallet-core': link:../taler-wallet-core
|
'@gnu-taler/taler-wallet-core': link:../taler-wallet-core
|
||||||
|
moment: 2.29.1
|
||||||
tslib: 2.1.0
|
tslib: 2.1.0
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@rollup/plugin-commonjs': 17.0.0_rollup@2.37.1
|
'@rollup/plugin-commonjs': 17.0.0_rollup@2.37.1
|
||||||
@ -192,6 +194,7 @@ importers:
|
|||||||
rollup-plugin-terser: 7.0.2_rollup@2.37.1
|
rollup-plugin-terser: 7.0.2_rollup@2.37.1
|
||||||
typescript: 4.1.3
|
typescript: 4.1.3
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@gnu-taler/taler-wallet-core': workspace:*
|
||||||
'@rollup/plugin-commonjs': ^17.0.0
|
'@rollup/plugin-commonjs': ^17.0.0
|
||||||
'@rollup/plugin-json': ^4.1.0
|
'@rollup/plugin-json': ^4.1.0
|
||||||
'@rollup/plugin-node-resolve': ^11.1.0
|
'@rollup/plugin-node-resolve': ^11.1.0
|
||||||
@ -212,7 +215,6 @@ importers:
|
|||||||
rollup-plugin-ignore: ^1.0.9
|
rollup-plugin-ignore: ^1.0.9
|
||||||
rollup-plugin-sourcemaps: ^0.6.3
|
rollup-plugin-sourcemaps: ^0.6.3
|
||||||
rollup-plugin-terser: ^7.0.2
|
rollup-plugin-terser: ^7.0.2
|
||||||
'@gnu-taler/taler-wallet-core': workspace:*
|
|
||||||
tslib: ^2.1.0
|
tslib: ^2.1.0
|
||||||
typescript: ^4.1.3
|
typescript: ^4.1.3
|
||||||
lockfileVersion: 5.2
|
lockfileVersion: 5.2
|
||||||
@ -1314,6 +1316,10 @@ packages:
|
|||||||
node: '>=6'
|
node: '>=6'
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
|
integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
|
||||||
|
/cancellationtoken/2.2.0:
|
||||||
|
dev: false
|
||||||
|
resolution:
|
||||||
|
integrity: sha512-uF4sHE5uh2VdEZtIRJKGoXAD9jm7bFY0tDRCzH4iLp262TOJ2lrtNHjMG2zc8H+GICOpELIpM7CGW5JeWnb3Hg==
|
||||||
/chalk/0.4.0:
|
/chalk/0.4.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
ansi-styles: 1.0.0
|
ansi-styles: 1.0.0
|
||||||
|
Loading…
Reference in New Issue
Block a user