diff options
Diffstat (limited to 'packages/taler-harness/src/harness')
-rw-r--r-- | packages/taler-harness/src/harness/harness.ts | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/packages/taler-harness/src/harness/harness.ts b/packages/taler-harness/src/harness/harness.ts index 83c8f60d1..e95dea0c6 100644 --- a/packages/taler-harness/src/harness/harness.ts +++ b/packages/taler-harness/src/harness/harness.ts @@ -1906,33 +1906,42 @@ function tryUnixConnect(socketPath: string): Promise<void> { }); } +export interface WalletServiceOptions { + useInMemoryDb?: boolean; + name: string; +} + export class WalletService { walletProc: ProcessWrapper | undefined; - constructor(private globalState: GlobalTestState, private name: string) {} + constructor( + private globalState: GlobalTestState, + private opts: WalletServiceOptions, + ) {} get socketPath() { - const unixPath = path.join(this.globalState.testDir, `${this.name}.sock`); + const unixPath = path.join( + this.globalState.testDir, + `${this.opts.name}.sock`, + ); return unixPath; } async start(): Promise<void> { - const dbPath = path.join( - this.globalState.testDir, - `walletdb-${this.name}.json`, - ); + let dbPath: string; + if (this.opts.useInMemoryDb) { + dbPath = ":memory:"; + } else { + dbPath = path.join( + this.globalState.testDir, + `walletdb-${this.opts.name}.json`, + ); + } const unixPath = this.socketPath; this.globalState.spawnService( "taler-wallet-cli", - [ - "--wallet-db", - dbPath, - "advanced", - "serve", - "--unix-path", - unixPath, - ], - `wallet-${this.name}`, + ["--wallet-db", dbPath, "advanced", "serve", "--unix-path", unixPath], + `wallet-${this.opts.name}`, ); } |