only shut down once

This commit is contained in:
Florian Dold 2020-08-07 11:33:48 +05:30
parent e79a118ab6
commit 32755f5475
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
5 changed files with 13 additions and 6 deletions

View File

@ -220,6 +220,7 @@ export class GlobalTestState {
testDir: string; testDir: string;
procs: ProcessWrapper[]; procs: ProcessWrapper[];
servers: http.Server[]; servers: http.Server[];
inShutdown: false;
constructor(params: GlobalTestParams) { constructor(params: GlobalTestParams) {
this.testDir = params.testDir; this.testDir = params.testDir;
this.procs = []; this.procs = [];
@ -307,8 +308,11 @@ export class GlobalTestState {
return procWrap; return procWrap;
} }
async terminate(): Promise<void> { async shutdown(): Promise<void> {
console.log("terminating"); if (this.inShutdown) {
return;
}
console.log("shutting down");
for (const s of this.servers) { for (const s of this.servers) {
s.close(); s.close();
s.removeAllListeners(); s.removeAllListeners();
@ -892,7 +896,7 @@ export function runTest(testMain: (gc: GlobalTestState) => Promise<void>) {
console.log("test logs and config can be found under", gc.testDir); console.log("test logs and config can be found under", gc.testDir);
console.log("keeping test environment running"); console.log("keeping test environment running");
} else { } else {
await gc.terminate(); await gc.shutdown();
console.log("test logs and config can be found under", gc.testDir); console.log("test logs and config can be found under", gc.testDir);
process.exit(ret); process.exit(ret);
} }

View File

@ -93,6 +93,7 @@ export const codecForCheckPaymentUnpaidResponse = (): codec.Codec<
.makeCodecForObject<CheckPaymentUnpaidResponse>() .makeCodecForObject<CheckPaymentUnpaidResponse>()
.property("order_status", codec.makeCodecForConstString("unpaid")) .property("order_status", codec.makeCodecForConstString("unpaid"))
.property("taler_pay_uri", codec.codecForString) .property("taler_pay_uri", codec.codecForString)
.property("order_status_url", codec.codecForString)
.property( .property(
"already_paid_order_id", "already_paid_order_id",
codec.makeCodecOptional(codec.codecForString), codec.makeCodecOptional(codec.codecForString),
@ -161,6 +162,8 @@ export interface CheckPaymentUnpaidResponse {
// URI that the wallet must process to complete the payment. // URI that the wallet must process to complete the payment.
taler_pay_uri: string; taler_pay_uri: string;
order_status_url: string;
// Alternative order ID which was paid for already in the same session. // Alternative order ID which was paid for already in the same session.
// Only given if the same product was purchased before in the same session. // Only given if the same product was purchased before in the same session.
already_paid_order_id?: string; already_paid_order_id?: string;

View File

@ -137,5 +137,5 @@ runTest(async (t: GlobalTestState) => {
t.assertTrue(orderStatus.order_status === "paid"); t.assertTrue(orderStatus.order_status === "paid");
await t.terminate(); await t.shutdown();
}); });

View File

@ -76,5 +76,5 @@ runTest(async (t: GlobalTestState) => {
t.assertTrue(orderStatus.order_status === "paid"); t.assertTrue(orderStatus.order_status === "paid");
await t.terminate(); await t.shutdown();
}); });

View File

@ -64,5 +64,5 @@ runTest(async (t: GlobalTestState) => {
const balResp = walletTypes.codecForBalancesResponse().decode(balApiResp.result); const balResp = walletTypes.codecForBalancesResponse().decode(balApiResp.result);
t.assertAmountEquals("TESTKUDOS:9.72", balResp.balances[0].available) t.assertAmountEquals("TESTKUDOS:9.72", balResp.balances[0].available)
await t.terminate(); await t.shutdown();
}); });