aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-harness
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-03-06 08:48:57 +0100
committerFlorian Dold <florian@dold.me>2024-03-06 08:49:13 +0100
commit12d2157cd71e9b0d93b70783694997ea5eb7cdb8 (patch)
treee4e6474d11bb9ed656a3f4636f9fd10eab32503e /packages/taler-harness
parenta7d034920ed7e81624e8e83808f2ee93dfc321f3 (diff)
downloadwallet-core-12d2157cd71e9b0d93b70783694997ea5eb7cdb8.tar.xz
harness: observability
Diffstat (limited to 'packages/taler-harness')
-rw-r--r--packages/taler-harness/src/harness/helpers.ts24
1 files changed, 17 insertions, 7 deletions
diff --git a/packages/taler-harness/src/harness/helpers.ts b/packages/taler-harness/src/harness/helpers.ts
index 46dc9f9d4..ea9047d0b 100644
--- a/packages/taler-harness/src/harness/helpers.ts
+++ b/packages/taler-harness/src/harness/helpers.ts
@@ -422,22 +422,32 @@ export async function createWalletDaemonWithClient(
await walletService.start();
await walletService.pingUntilAvailable();
+ const observabilityEventFile = t.testDir + `/wallet-${args.name}-notifs.log`;
+
+ const onNotif = (notif: WalletNotification) => {
+ if (observabilityEventFile) {
+ fs.appendFileSync(
+ observabilityEventFile,
+ new Date().toISOString() + " " + JSON.stringify(notif) + "\n",
+ );
+ }
+ if (args.handleNotification) {
+ args.handleNotification(notif);
+ }
+ };
+
const walletClient = new WalletClient({
name: args.name,
unixPath: walletService.socketPath,
- onNotification(n) {
- console.log(`got ${args.name} notification`, n);
- if (args.handleNotification) {
- args.handleNotification(n);
- }
- },
+ onNotification: onNotif,
});
await walletClient.connect();
const defaultRunConfig = {
testing: {
skipDefaults: true,
+ emitObservabilityEvents: !!process.env["TALER_TEST_OBSERVABILITY"],
},
- };
+ } satisfies PartialWalletRunConfig;
await walletClient.client.call(WalletApiOperation.InitWallet, {
config: args.config ?? defaultRunConfig,
});