aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-harness/src/harness/helpers.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-harness/src/harness/helpers.ts')
-rw-r--r--packages/taler-harness/src/harness/helpers.ts40
1 files changed, 28 insertions, 12 deletions
diff --git a/packages/taler-harness/src/harness/helpers.ts b/packages/taler-harness/src/harness/helpers.ts
index 932854a1e..d41ffdd00 100644
--- a/packages/taler-harness/src/harness/helpers.ts
+++ b/packages/taler-harness/src/harness/helpers.ts
@@ -230,6 +230,11 @@ export async function useSharedTestkudosEnvironment(t: GlobalTestState) {
logger.info(`previous setup done: ${prevSetupDone}`);
+
+ // Wallet has longer startup-time and no dependencies,
+ // so we start it rather early.
+ const walletStartProm = createWalletDaemonWithClient(t, { name: "wallet" })
+
if (fs.existsSync(sharedDir + "/bank.conf")) {
logger.info("reusing existing bank");
bank = BankService.fromExistingConfig(t, {
@@ -249,15 +254,19 @@ export async function useSharedTestkudosEnvironment(t: GlobalTestState) {
logger.info("setting up exchange");
const exchangeName = "testexchange-1";
- const exchangeConfigFilename = sharedDir + `/exchange-${exchangeName}}`;
+ const exchangeConfigFilename = sharedDir + `/exchange-${exchangeName}.conf`;
+
+ logger.info(`exchange config filename: ${exchangeConfigFilename}`);
let exchange: ExchangeService;
if (fs.existsSync(exchangeConfigFilename)) {
+ logger.info("reusing existing exchange config");
exchange = ExchangeService.fromExistingConfig(t, exchangeName, {
overridePath: sharedDir,
});
} else {
+ logger.info("creating new exchange config");
exchange = ExchangeService.create(t, {
name: "testexchange-1",
currency: "TESTKUDOS",
@@ -305,22 +314,29 @@ export async function useSharedTestkudosEnvironment(t: GlobalTestState) {
logger.info("basic setup done, starting services");
+ if (!prevSetupDone) {
+ // Must be done sequentially, due to a concurrency
+ // issue in the *-dbinit tools.
+ await exchange.dbinit();
+ await merchant.dbinit();
+ }
+
const bankStart = async () => {
await bank.start();
-
await bank.pingUntilAvailable();
};
const exchangeStart = async () => {
await exchange.start({
- skipSetup: prevSetupDone,
+ skipDbinit: true,
+ skipKeyup: prevSetupDone,
});
await exchange.pingUntilAvailable();
};
const merchStart = async () => {
await merchant.start({
- skipSetup: prevSetupDone,
+ skipDbinit: true,
});
await merchant.pingUntilAvailable();
@@ -345,24 +361,22 @@ export async function useSharedTestkudosEnvironment(t: GlobalTestState) {
}
};
- const walletStart = async () => {
- return await createWalletDaemonWithClient(t, { name: "wallet" });
- };
+ await bankStart()
const res = await Promise.all([
exchangeStart(),
merchStart(),
- bankStart(),
- walletStart(),
+ undefined,
+ walletStartProm,
]);
const walletClient = res[3].walletClient;
const walletService = res[3].walletService;
- console.log("setup done!");
-
fs.writeFileSync(sharedDir + "/setup-done", "OK");
+ logger.info("setup done!");
+
return {
commonDb: db,
exchange,
@@ -515,7 +529,7 @@ export async function createWalletDaemonWithClient(
const walletClient = new WalletClient({
unixPath: walletService.socketPath,
onNotification(n) {
- console.log("got notification", n);
+ console.log(`got ${args.name} notification`, n);
if (args.handleNotification) {
args.handleNotification(n);
}
@@ -789,6 +803,8 @@ export async function applyTimeTravel(
/**
* Make a simple payment and check that it succeeded.
+ *
+ * @deprecated
*/
export async function makeTestPayment(
t: GlobalTestState,