gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: harness, wallet-cli: allow in


From: gnunet
Subject: [taler-wallet-core] branch master updated: harness, wallet-cli: allow in-memory DB
Date: Thu, 02 Feb 2023 20:37:18 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new 9d6613619 harness,wallet-cli: allow in-memory DB
9d6613619 is described below

commit 9d6613619e052aba429e042a25744f1160950d15
Author: Florian Dold <florian@dold.me>
AuthorDate: Thu Feb 2 20:37:15 2023 +0100

    harness,wallet-cli: allow in-memory DB
---
 packages/taler-harness/src/harness/harness.ts      | 39 +++++++++++++---------
 .../integrationtests/test-wallet-notifications.ts  |  5 ++-
 packages/taler-wallet-cli/src/index.ts             |  2 +-
 3 files changed, 29 insertions(+), 17 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}`,
     );
   }
 
diff --git 
a/packages/taler-harness/src/integrationtests/test-wallet-notifications.ts 
b/packages/taler-harness/src/integrationtests/test-wallet-notifications.ts
index 23c71ea2f..9f591b9d0 100644
--- a/packages/taler-harness/src/integrationtests/test-wallet-notifications.ts
+++ b/packages/taler-harness/src/integrationtests/test-wallet-notifications.ts
@@ -107,7 +107,10 @@ export async function runWalletNotificationsTest(t: 
GlobalTestState) {
 
   console.log("setup done!");
 
-  const walletService = new WalletService(t, "wallet");
+  const walletService = new WalletService(t, {
+    name: "wallet",
+    useInMemoryDb: true,
+  });
   await walletService.start();
   await walletService.pingUntilAvailable();
 
diff --git a/packages/taler-wallet-cli/src/index.ts 
b/packages/taler-wallet-cli/src/index.ts
index cce982dfb..1e0f1b5cb 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -250,7 +250,7 @@ async function createLocalWallet(
     myHttpLib.setThrottling(false);
   }
   const wallet = await getDefaultNodeWallet({
-    persistentStoragePath: dbPath,
+    persistentStoragePath: dbPath !== ":memory:" ? dbPath : undefined,
     httpLib: myHttpLib,
     notifyHandler: (n) => {
       logger.info(`wallet notification: ${j2s(n)}`);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]