diff options
author | Florian Dold <florian@dold.me> | 2024-09-09 16:41:11 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-09-09 16:41:11 +0200 |
commit | 0174bcb85541546671cf703b528d3270baaa586b (patch) | |
tree | 1ced36b6599649b5a1066dce7cb4f1005a303943 | |
parent | 9d1262c75a98c32100cbd074e62f59fe40c27d55 (diff) | |
download | wallet-core-0174bcb85541546671cf703b528d3270baaa586b.tar.xz |
harness: run new merchant helper processes in tests
-rw-r--r-- | packages/taler-harness/src/harness/harness.ts | 58 |
1 files changed, 50 insertions, 8 deletions
diff --git a/packages/taler-harness/src/harness/harness.ts b/packages/taler-harness/src/harness/harness.ts index 6a9188d13..659575700 100644 --- a/packages/taler-harness/src/harness/harness.ts +++ b/packages/taler-harness/src/harness/harness.ts @@ -1678,7 +1678,9 @@ export class MerchantService implements MerchantServiceInterface { return new MerchantService(gc, mc, cfgFilename); } - proc: ProcessWrapper | undefined; + procHttpd: ProcessWrapper | undefined; + procExchangekeyupdate: ProcessWrapper | undefined; + procKyccheck: ProcessWrapper | undefined; constructor( private globalState: GlobalTestState, @@ -1689,7 +1691,7 @@ export class MerchantService implements MerchantServiceInterface { private currentTimetravelOffsetMs: number | undefined; private isRunning(): boolean { - return !!this.proc; + return !!this.procHttpd; } setTimetravel(t: number | undefined): void { @@ -1729,11 +1731,23 @@ export class MerchantService implements MerchantServiceInterface { } async stop(): Promise<void> { - const httpd = this.proc; + const httpd = this.procHttpd; if (httpd) { httpd.proc.kill("SIGTERM"); await httpd.wait(); - this.proc = undefined; + this.procHttpd = undefined; + } + const exchangekeyupdate = this.procExchangekeyupdate; + if (exchangekeyupdate) { + exchangekeyupdate.proc.kill("SIGTERM"); + await exchangekeyupdate.wait(); + this.procExchangekeyupdate = undefined; + } + const kyccheck = this.procKyccheck; + if (kyccheck) { + kyccheck.proc.kill("SIGTERM"); + await kyccheck.wait(); + this.procKyccheck = undefined; } } @@ -1756,7 +1770,7 @@ export class MerchantService implements MerchantServiceInterface { await this.dbinit(); } - this.proc = this.globalState.spawnService( + this.procHttpd = this.globalState.spawnService( "taler-merchant-httpd", [ "taler-merchant-httpd", @@ -1765,7 +1779,31 @@ export class MerchantService implements MerchantServiceInterface { this.configFilename, ...this.timetravelArgArr, ], - `merchant-${this.merchantConfig.name}`, + `merchant-httpd-${this.merchantConfig.name}`, + ); + + this.procExchangekeyupdate = this.globalState.spawnService( + "taler-merchant-exchangekeyupdate", + [ + "taler-merchant-exchangekeyupdate", + "-LDEBUG", + "-c", + this.configFilename, + ...this.timetravelArgArr, + ], + `merchant-exchangekeyupdate-${this.merchantConfig.name}`, + ); + + this.procKyccheck = this.globalState.spawnService( + "taler-merchant-kyccheck", + [ + "taler-merchant-kyccheck", + "-LDEBUG", + "-c", + this.configFilename, + ...this.timetravelArgArr, + ], + `merchant-kyccheck-${this.merchantConfig.name}`, ); await this.pingUntilAvailable(); @@ -1836,7 +1874,7 @@ export class MerchantService implements MerchantServiceInterface { async addInstanceWithWireAccount( instanceConfig: PartialMerchantInstanceConfig, ): Promise<void> { - if (!this.proc) { + if (!this.procHttpd) { throw Error("merchant must be running to add instance"); } logger.info(`adding instance '${instanceConfig.id}'`); @@ -1888,7 +1926,11 @@ export class MerchantService implements MerchantServiceInterface { async pingUntilAvailable(): Promise<void> { const url = `http://localhost:${this.merchantConfig.httpPort}/config`; - await pingProc(this.proc, url, `merchant (${this.merchantConfig.name})`); + await pingProc( + this.procHttpd, + url, + `merchant (${this.merchantConfig.name})`, + ); } } |