aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-cli
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-01-13 00:50:56 +0100
committerFlorian Dold <florian@dold.me>2021-01-13 00:50:56 +0100
commit050999a910837f8a5353b1584af2b03bd8dad93d (patch)
tree8b3611476d61be56411be4104194dddda5f6d6c2 /packages/taler-wallet-cli
parenta5681579fbddb001f5b7118fe705c6643581c722 (diff)
implement infrastructure for future DB migrations via backup
Diffstat (limited to 'packages/taler-wallet-cli')
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/harness.ts20
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/testrunner.ts11
2 files changed, 21 insertions, 10 deletions
diff --git a/packages/taler-wallet-cli/src/integrationtests/harness.ts b/packages/taler-wallet-cli/src/integrationtests/harness.ts
index 108b78540..4985c5fc1 100644
--- a/packages/taler-wallet-cli/src/integrationtests/harness.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/harness.ts
@@ -78,6 +78,7 @@ import {
AcceptTipRequest,
AbortPayWithRefundRequest,
handleWorkerError,
+ openPromise,
} from "taler-wallet-core";
import { URL } from "url";
import axios, { AxiosError } from "axios";
@@ -94,7 +95,6 @@ import {
import { ApplyRefundResponse } from "taler-wallet-core";
import { PendingOperationsResponse } from "taler-wallet-core";
import { CoinConfig } from "./denomStructures";
-import { after } from "taler-wallet-core/src/util/timer";
const exec = util.promisify(require("child_process").exec);
@@ -1114,11 +1114,14 @@ export class ExchangeService implements ExchangeServiceInterface {
`exchange-httpd-${this.name}`,
);
+ await this.pingUntilAvailable();
await this.keyup();
}
async pingUntilAvailable(): Promise<void> {
- const url = `http://localhost:${this.exchangeConfig.httpPort}/keys`;
+ // We request /management/keys, since /keys can block
+ // when we didn't do the key setup yet.
+ const url = `http://localhost:${this.exchangeConfig.httpPort}/management/keys`;
await pingProc(this.exchangeHttpProc, url, `exchange (${this.name})`);
}
}
@@ -1449,10 +1452,14 @@ export async function runTestWithState(
): Promise<TestRunResult> {
const startMs = new Date().getTime();
- const handleSignal = () => {
+ const p = openPromise();
+ let status: TestStatus;
+
+ const handleSignal = (s: string) => {
gc.shutdownSync();
- console.warn("**** received fatal signal, shutting down test harness");
- process.exit(1);
+ console.warn("**** received fatal proces event, shutting down test harness");
+ status = "fail";
+ p.reject(Error("caught signal"));
};
process.on("SIGINT", handleSignal);
@@ -1460,10 +1467,9 @@ export async function runTestWithState(
process.on("unhandledRejection", handleSignal);
process.on("uncaughtException", handleSignal);
- let status: TestStatus;
try {
console.log("running test in directory", gc.testDir);
- await testMain(gc);
+ await Promise.race([testMain(gc), p.promise]);
status = "pass";
} catch (e) {
console.error("FATAL: test failed with exception", e);
diff --git a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
index d9804562e..578e9488c 100644
--- a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
@@ -66,12 +66,13 @@ const allTests: TestMainFunction[] = [
runMerchantLongpollingTest,
runMerchantRefundApiTest,
runPayAbortTest,
- runPayPaidTest,
runPaymentClaimTest,
runPaymentFaultTest,
runPaymentIdempotencyTest,
runPaymentMultipleTest,
+ runPaymentTest,
runPaymentTransientTest,
+ runPayPaidTest,
runPaywallFlowTest,
runRefundAutoTest,
runRefundGoneTest,
@@ -82,10 +83,9 @@ const allTests: TestMainFunction[] = [
runTimetravelWithdrawTest,
runTippingTest,
runWallettestingTest,
+ runTestWithdrawalManualTest,
runWithdrawalAbortBankTest,
runWithdrawalBankIntegratedTest,
- runWallettestingTest,
- runPaymentTest,
];
export interface TestRunSpec {
@@ -166,7 +166,12 @@ export async function runTests(spec: TestRunSpec) {
JSON.stringify({ testResults }, undefined, 2),
);
console.log(`See ${resultsFile} for details`);
+ console.log(`Skipped: ${numSkip}/${numTotal}`);
+ console.log(`Failed: ${numFail}/${numTotal}`);
console.log(`Passed: ${numPass}/${numTotal}`);
+ if (numPass < numTotal - numSkip) {
+ process.exit(1);
+ }
}
export function getTestInfo(): TestInfo[] {