integration tests: make test-wallet-cryptoworker pass
This commit is contained in:
parent
70d37e4ed3
commit
99ace8b7d2
@ -182,7 +182,7 @@ export const walletCli = clk
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.maybeOption("cryptoWorker", ["--crypto-worker"], clk.STRING, {
|
.maybeOption("cryptoWorker", ["--crypto-worker"], clk.STRING, {
|
||||||
help: "Override crypto worker implementation type."
|
help: "Override crypto worker implementation type.",
|
||||||
})
|
})
|
||||||
.maybeOption("log", ["-L", "--log"], clk.STRING, {
|
.maybeOption("log", ["-L", "--log"], clk.STRING, {
|
||||||
help: "configure log level (NONE, ..., TRACE)",
|
help: "configure log level (NONE, ..., TRACE)",
|
||||||
@ -729,6 +729,14 @@ const advancedCli = walletCli.subcommand("advancedArgs", "advanced", {
|
|||||||
help: "Subcommands for advanced operations (only use if you know what you're doing!).",
|
help: "Subcommands for advanced operations (only use if you know what you're doing!).",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
advancedCli
|
||||||
|
.subcommand("init", "init", {
|
||||||
|
help: "Initialize the wallet (with DB) and exit."
|
||||||
|
})
|
||||||
|
.action(async (args) => {
|
||||||
|
await withWallet(args, async () => {});
|
||||||
|
});
|
||||||
|
|
||||||
advancedCli
|
advancedCli
|
||||||
.subcommand("bench1", "bench1", {
|
.subcommand("bench1", "bench1", {
|
||||||
help: "Run the 'bench1' benchmark",
|
help: "Run the 'bench1' benchmark",
|
||||||
|
@ -43,13 +43,13 @@ export async function runWalletCryptoWorkerTest(t: GlobalTestState) {
|
|||||||
cryptoWorkerType: "sync",
|
cryptoWorkerType: "sync",
|
||||||
});
|
});
|
||||||
|
|
||||||
await wallet1.client.call(WalletApiOperation.CryptoTest, {});
|
await wallet1.client.call(WalletApiOperation.TestCrypto, {});
|
||||||
|
|
||||||
const wallet2 = new WalletCli(t, "w2", {
|
const wallet2 = new WalletCli(t, "w2", {
|
||||||
cryptoWorkerType: "node-worker-thread",
|
cryptoWorkerType: "node-worker-thread",
|
||||||
});
|
});
|
||||||
|
|
||||||
await wallet2.client.call(WalletApiOperation.CryptoTest, {});
|
await wallet2.client.call(WalletApiOperation.TestCrypto, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
runWalletCryptoWorkerTest.suites = ["wallet"];
|
runWalletCryptoWorkerTest.suites = ["wallet"];
|
||||||
|
@ -37,6 +37,7 @@ export async function processRequestWithImpl(
|
|||||||
reqMsg: CryptoWorkerRequestMessage,
|
reqMsg: CryptoWorkerRequestMessage,
|
||||||
impl: TalerCryptoInterfaceR,
|
impl: TalerCryptoInterfaceR,
|
||||||
): Promise<CryptoWorkerResponseMessage> {
|
): Promise<CryptoWorkerResponseMessage> {
|
||||||
|
logger.info(`processing crypto request ${j2s(reqMsg)}`);
|
||||||
if (typeof reqMsg !== "object") {
|
if (typeof reqMsg !== "object") {
|
||||||
logger.error("request must be an object");
|
logger.error("request must be an object");
|
||||||
return {
|
return {
|
||||||
@ -85,7 +86,7 @@ export async function processRequestWithImpl(
|
|||||||
let responseMsg: CryptoWorkerResponseMessage;
|
let responseMsg: CryptoWorkerResponseMessage;
|
||||||
|
|
||||||
try {
|
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 };
|
responseMsg = { type: "success", result, id };
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
logger.error(`error during operation: ${e.stack ?? e.toString()}`);
|
logger.error(`error during operation: ${e.stack ?? e.toString()}`);
|
||||||
|
@ -92,7 +92,7 @@ export enum WalletApiOperation {
|
|||||||
WithdrawTestBalance = "withdrawTestBalance",
|
WithdrawTestBalance = "withdrawTestBalance",
|
||||||
PreparePayForUri = "preparePayForUri",
|
PreparePayForUri = "preparePayForUri",
|
||||||
RunIntegrationTest = "runIntegrationTest",
|
RunIntegrationTest = "runIntegrationTest",
|
||||||
CryptoTest = "cryptoTest",
|
TestCrypto = "testCrypto",
|
||||||
TestPay = "testPay",
|
TestPay = "testPay",
|
||||||
AddExchange = "addExchange",
|
AddExchange = "addExchange",
|
||||||
GetTransactions = "getTransactions",
|
GetTransactions = "getTransactions",
|
||||||
@ -528,8 +528,8 @@ export type RunIntegrationTestOp = {
|
|||||||
/**
|
/**
|
||||||
* Test crypto worker.
|
* Test crypto worker.
|
||||||
*/
|
*/
|
||||||
export type CryptoTestOp = {
|
export type TestCryptoOp = {
|
||||||
op: WalletApiOperation.CryptoTest;
|
op: WalletApiOperation.TestCrypto;
|
||||||
request: {};
|
request: {};
|
||||||
response: any;
|
response: any;
|
||||||
};
|
};
|
||||||
@ -649,7 +649,7 @@ export type WalletOperations = {
|
|||||||
[WalletApiOperation.AddBackupProvider]: AddBackupProviderOp;
|
[WalletApiOperation.AddBackupProvider]: AddBackupProviderOp;
|
||||||
[WalletApiOperation.GetBackupInfo]: GetBackupInfoOp;
|
[WalletApiOperation.GetBackupInfo]: GetBackupInfoOp;
|
||||||
[WalletApiOperation.RunIntegrationTest]: RunIntegrationTestOp;
|
[WalletApiOperation.RunIntegrationTest]: RunIntegrationTestOp;
|
||||||
[WalletApiOperation.CryptoTest]: CryptoTestOp;
|
[WalletApiOperation.TestCrypto]: TestCryptoOp;
|
||||||
[WalletApiOperation.WithdrawTestBalance]: WithdrawTestBalanceOp;
|
[WalletApiOperation.WithdrawTestBalance]: WithdrawTestBalanceOp;
|
||||||
[WalletApiOperation.TestPay]: TestPayOp;
|
[WalletApiOperation.TestPay]: TestPayOp;
|
||||||
[WalletApiOperation.ExportDb]: ExportDbOp;
|
[WalletApiOperation.ExportDb]: ExportDbOp;
|
||||||
|
Loading…
Reference in New Issue
Block a user