aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-10-05 16:01:59 +0200
committerFlorian Dold <florian@dold.me>2022-10-05 16:01:59 +0200
commit99ace8b7d24416f2b184d66006c89b61935e132e (patch)
treead801a936ed6c05c4fb3a16be324f0de50654d8e
parent70d37e4ed30e69c4b3ba2d31a50fd61d82b91252 (diff)
integration tests: make test-wallet-cryptoworker pass
-rw-r--r--packages/taler-wallet-cli/src/index.ts10
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-wallet-cryptoworker.ts4
-rw-r--r--packages/taler-wallet-core/src/crypto/workers/worker-common.ts3
-rw-r--r--packages/taler-wallet-core/src/wallet-api-types.ts8
4 files changed, 17 insertions, 8 deletions
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts
index 47a520c83..c1afbe15c 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -182,7 +182,7 @@ export const walletCli = clk
},
})
.maybeOption("cryptoWorker", ["--crypto-worker"], clk.STRING, {
- help: "Override crypto worker implementation type."
+ help: "Override crypto worker implementation type.",
})
.maybeOption("log", ["-L", "--log"], clk.STRING, {
help: "configure log level (NONE, ..., TRACE)",
@@ -730,6 +730,14 @@ const advancedCli = walletCli.subcommand("advancedArgs", "advanced", {
});
advancedCli
+ .subcommand("init", "init", {
+ help: "Initialize the wallet (with DB) and exit."
+ })
+ .action(async (args) => {
+ await withWallet(args, async () => {});
+ });
+
+advancedCli
.subcommand("bench1", "bench1", {
help: "Run the 'bench1' benchmark",
})
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-wallet-cryptoworker.ts b/packages/taler-wallet-cli/src/integrationtests/test-wallet-cryptoworker.ts
index fefdab27a..cc0e23a3c 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-wallet-cryptoworker.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-wallet-cryptoworker.ts
@@ -43,13 +43,13 @@ export async function runWalletCryptoWorkerTest(t: GlobalTestState) {
cryptoWorkerType: "sync",
});
- await wallet1.client.call(WalletApiOperation.CryptoTest, {});
+ await wallet1.client.call(WalletApiOperation.TestCrypto, {});
const wallet2 = new WalletCli(t, "w2", {
cryptoWorkerType: "node-worker-thread",
});
- await wallet2.client.call(WalletApiOperation.CryptoTest, {});
+ await wallet2.client.call(WalletApiOperation.TestCrypto, {});
}
runWalletCryptoWorkerTest.suites = ["wallet"];
diff --git a/packages/taler-wallet-core/src/crypto/workers/worker-common.ts b/packages/taler-wallet-core/src/crypto/workers/worker-common.ts
index 67af68f35..dae6d1e28 100644
--- a/packages/taler-wallet-core/src/crypto/workers/worker-common.ts
+++ b/packages/taler-wallet-core/src/crypto/workers/worker-common.ts
@@ -37,6 +37,7 @@ export async function processRequestWithImpl(
reqMsg: CryptoWorkerRequestMessage,
impl: TalerCryptoInterfaceR,
): Promise<CryptoWorkerResponseMessage> {
+ logger.info(`processing crypto request ${j2s(reqMsg)}`);
if (typeof reqMsg !== "object") {
logger.error("request must be an object");
return {
@@ -85,7 +86,7 @@ export async function processRequestWithImpl(
let responseMsg: CryptoWorkerResponseMessage;
try {
- const result = await (impl as any)[operation](impl, reqMsg);
+ const result = await (impl as any)[operation](impl, reqMsg.req);
responseMsg = { type: "success", result, id };
} catch (e: any) {
logger.error(`error during operation: ${e.stack ?? e.toString()}`);
diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts b/packages/taler-wallet-core/src/wallet-api-types.ts
index 2860a6972..15de5faf9 100644
--- a/packages/taler-wallet-core/src/wallet-api-types.ts
+++ b/packages/taler-wallet-core/src/wallet-api-types.ts
@@ -92,7 +92,7 @@ export enum WalletApiOperation {
WithdrawTestBalance = "withdrawTestBalance",
PreparePayForUri = "preparePayForUri",
RunIntegrationTest = "runIntegrationTest",
- CryptoTest = "cryptoTest",
+ TestCrypto = "testCrypto",
TestPay = "testPay",
AddExchange = "addExchange",
GetTransactions = "getTransactions",
@@ -528,8 +528,8 @@ export type RunIntegrationTestOp = {
/**
* Test crypto worker.
*/
-export type CryptoTestOp = {
- op: WalletApiOperation.CryptoTest;
+export type TestCryptoOp = {
+ op: WalletApiOperation.TestCrypto;
request: {};
response: any;
};
@@ -649,7 +649,7 @@ export type WalletOperations = {
[WalletApiOperation.AddBackupProvider]: AddBackupProviderOp;
[WalletApiOperation.GetBackupInfo]: GetBackupInfoOp;
[WalletApiOperation.RunIntegrationTest]: RunIntegrationTestOp;
- [WalletApiOperation.CryptoTest]: CryptoTestOp;
+ [WalletApiOperation.TestCrypto]: TestCryptoOp;
[WalletApiOperation.WithdrawTestBalance]: WithdrawTestBalanceOp;
[WalletApiOperation.TestPay]: TestPayOp;
[WalletApiOperation.ExportDb]: ExportDbOp;