aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-01-10 12:14:03 +0100
committerFlorian Dold <florian@dold.me>2023-01-10 12:14:08 +0100
commite8baaf5eb1acf30aee9ebd8744bec31a79a782c2 (patch)
treea64fcba142832393c026d58b83593bbf21ab6c99
parentcfe33c8e2701c5ad4edb16ff9403be7d95561fe3 (diff)
harness: capture createdb/dropdb logs
-rw-r--r--packages/taler-harness/src/harness/harness.ts22
1 files changed, 14 insertions, 8 deletions
diff --git a/packages/taler-harness/src/harness/harness.ts b/packages/taler-harness/src/harness/harness.ts
index 6f722dc8d..a9298637f 100644
--- a/packages/taler-harness/src/harness/harness.ts
+++ b/packages/taler-harness/src/harness/harness.ts
@@ -63,7 +63,6 @@ import * as http from "http";
import * as path from "path";
import * as readline from "readline";
import { URL } from "url";
-import * as util from "util";
import { CoinConfig } from "./denomStructures.js";
import { LibeufinNexusApi, LibeufinSandboxApi } from "./libeufin-apis.js";
import {
@@ -78,8 +77,6 @@ import {
TippingReserveStatus,
} from "./merchantApiTypes.js";
-const exec = util.promisify(child_process.exec);
-
const axios = axiosImp.default;
export async function delayMs(ms: number): Promise<void> {
@@ -390,10 +387,14 @@ export interface DbInfo {
dbname: string;
}
-export async function setupDb(gc: GlobalTestState): Promise<DbInfo> {
+export async function setupDb(t: GlobalTestState): Promise<DbInfo> {
const dbname = "taler-integrationtest";
- await exec(`dropdb "${dbname}" || true`);
- await exec(`createdb "${dbname}"`);
+ try {
+ await runCommand(t, "dropdb", "dropdb", [dbname]);
+ } catch (e: any) {
+ logger.warn(`dropdb failed: ${e.toString()}`);
+ }
+ await runCommand(t, "createdb", "createdb", [dbname]);
return {
connStr: `postgres:///${dbname}`,
dbname,
@@ -1236,7 +1237,7 @@ export class ExchangeService implements ExchangeServiceInterface {
// Wire fee
`${this.exchangeConfig.currency}:0.01`,
// Closing fee
- `${this.exchangeConfig.currency}:0.01`,
+ `${this.exchangeConfig.currency}:0.01`,
"upload",
],
);
@@ -1631,7 +1632,12 @@ export class MerchantService implements MerchantServiceInterface {
}
async start(): Promise<void> {
- await exec(`taler-merchant-dbinit -c "${this.configFilename}"`);
+ await runCommand(
+ this.globalState,
+ "merchant-dbinit",
+ "taler-merchant-dbinit",
+ ["-c", this.configFilename],
+ );
this.proc = this.globalState.spawnService(
"taler-merchant-httpd",