harness: capture createdb/dropdb logs
This commit is contained in:
parent
cfe33c8e27
commit
e8baaf5eb1
@ -63,7 +63,6 @@ import * as http from "http";
|
|||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
import * as readline from "readline";
|
import * as readline from "readline";
|
||||||
import { URL } from "url";
|
import { URL } from "url";
|
||||||
import * as util from "util";
|
|
||||||
import { CoinConfig } from "./denomStructures.js";
|
import { CoinConfig } from "./denomStructures.js";
|
||||||
import { LibeufinNexusApi, LibeufinSandboxApi } from "./libeufin-apis.js";
|
import { LibeufinNexusApi, LibeufinSandboxApi } from "./libeufin-apis.js";
|
||||||
import {
|
import {
|
||||||
@ -78,8 +77,6 @@ import {
|
|||||||
TippingReserveStatus,
|
TippingReserveStatus,
|
||||||
} from "./merchantApiTypes.js";
|
} from "./merchantApiTypes.js";
|
||||||
|
|
||||||
const exec = util.promisify(child_process.exec);
|
|
||||||
|
|
||||||
const axios = axiosImp.default;
|
const axios = axiosImp.default;
|
||||||
|
|
||||||
export async function delayMs(ms: number): Promise<void> {
|
export async function delayMs(ms: number): Promise<void> {
|
||||||
@ -390,10 +387,14 @@ export interface DbInfo {
|
|||||||
dbname: string;
|
dbname: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setupDb(gc: GlobalTestState): Promise<DbInfo> {
|
export async function setupDb(t: GlobalTestState): Promise<DbInfo> {
|
||||||
const dbname = "taler-integrationtest";
|
const dbname = "taler-integrationtest";
|
||||||
await exec(`dropdb "${dbname}" || true`);
|
try {
|
||||||
await exec(`createdb "${dbname}"`);
|
await runCommand(t, "dropdb", "dropdb", [dbname]);
|
||||||
|
} catch (e: any) {
|
||||||
|
logger.warn(`dropdb failed: ${e.toString()}`);
|
||||||
|
}
|
||||||
|
await runCommand(t, "createdb", "createdb", [dbname]);
|
||||||
return {
|
return {
|
||||||
connStr: `postgres:///${dbname}`,
|
connStr: `postgres:///${dbname}`,
|
||||||
dbname,
|
dbname,
|
||||||
@ -1631,7 +1632,12 @@ export class MerchantService implements MerchantServiceInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async start(): Promise<void> {
|
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(
|
this.proc = this.globalState.spawnService(
|
||||||
"taler-merchant-httpd",
|
"taler-merchant-httpd",
|
||||||
|
Loading…
Reference in New Issue
Block a user