diff options
author | Florian Dold <florian@dold.me> | 2024-01-08 18:51:38 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-01-08 18:51:45 +0100 |
commit | 2987f6f8365a15c6761a370bfd0ebf0952ce3f66 (patch) | |
tree | cbaf22fb5a44efced31de485c3658edbbbc98731 /packages/taler-harness/src | |
parent | b0610d24571593909cd6683b340fa266de046e31 (diff) | |
download | wallet-core-2987f6f8365a15c6761a370bfd0ebf0952ce3f66.tar.xz |
wallet-core: fix error reporting for exchange entries
Diffstat (limited to 'packages/taler-harness/src')
4 files changed, 46 insertions, 10 deletions
diff --git a/packages/taler-harness/src/harness/harness.ts b/packages/taler-harness/src/harness/harness.ts index ea2406f52..a8cd1131d 100644 --- a/packages/taler-harness/src/harness/harness.ts +++ b/packages/taler-harness/src/harness/harness.ts @@ -1013,6 +1013,18 @@ export class ExchangeService implements ExchangeServiceInterface { ); } + /** + * Run the taler-exchange-expire command once in test mode. + */ + async runExpireOnce() { + await runCommand( + this.globalState, + `exchange-${this.name}-expire-once`, + "taler-exchange-expire", + [...this.timetravelArgArr, "-c", this.configFilename, "-t"], + ); + } + changeConfig(f: (config: Configuration) => void) { const config = Configuration.load(this.configFilename); f(config); @@ -1056,6 +1068,9 @@ export class ExchangeService implements ExchangeServiceInterface { config.setString("taler-exchange-secmod-eddsa", "lookahead_sign", "20 s"); config.setString("taler-exchange-secmod-rsa", "lookahead_sign", "20 s"); + // FIXME: Remove once the exchange default config properly ships this. + config.setString("exchange", "EXPIRE_IDLE_SLEEP_INTERVAL", "1 s"); + const exchangeMasterKey = createEddsaKeyPair(); config.setString( diff --git a/packages/taler-harness/src/integrationtests/test-exchange-management.ts b/packages/taler-harness/src/integrationtests/test-exchange-management.ts index e7ebfffc8..37b490d6b 100644 --- a/packages/taler-harness/src/integrationtests/test-exchange-management.ts +++ b/packages/taler-harness/src/integrationtests/test-exchange-management.ts @@ -190,11 +190,14 @@ export async function runExchangeManagementTest( }); }); + console.log("got error", err1); + // Response is malformed, since it didn't even contain a version code // in a format the wallet can understand. t.assertTrue( - err1.errorDetail.code === TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE, + err1.errorDetail.code === TalerErrorCode.WALLET_EXCHANGE_UNAVAILABLE, ); + exchangesList = await wallet.client.call( WalletApiOperation.ListExchanges, {}, @@ -235,11 +238,7 @@ export async function runExchangeManagementTest( }); }); - t.assertTrue( - err2.hasErrorCode( - TalerErrorCode.WALLET_EXCHANGE_PROTOCOL_VERSION_INCOMPATIBLE, - ), - ); + t.assertTrue(err2.hasErrorCode(TalerErrorCode.WALLET_EXCHANGE_UNAVAILABLE)); exchangesList = await wallet.client.call( WalletApiOperation.ListExchanges, diff --git a/packages/taler-harness/src/integrationtests/test-peer-to-peer-push.ts b/packages/taler-harness/src/integrationtests/test-peer-to-peer-push.ts index 583dba28d..bf0c7a78f 100644 --- a/packages/taler-harness/src/integrationtests/test-peer-to-peer-push.ts +++ b/packages/taler-harness/src/integrationtests/test-peer-to-peer-push.ts @@ -31,7 +31,6 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - applyTimeTravelV2, createSimpleTestkudosEnvironmentV2, createWalletDaemonWithClient, withdrawViaBankV2, @@ -194,11 +193,19 @@ export async function runPeerToPeerPushTest(t: GlobalTestState) { Duration.fromSpec({ days: 5 }), ); + console.log("stopping exchange to apply time-travel"); + await exchange.stop(); exchange.setTimetravel(timetravelOffsetMs); await exchange.start(); await exchange.pingUntilAvailable(); + console.log("running expire"); + await exchange.runExpireOnce(); + console.log("done running expire"); + + console.log("purse should now be expired"); + await w1.walletClient.call(WalletApiOperation.TestingSetTimetravel, { offsetMs: timetravelOffsetMs, }); diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts index 781a0fe90..0209a6cbf 100644 --- a/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts +++ b/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts @@ -22,6 +22,7 @@ import { AmountString, Duration, Logger, + TalerBankConversionApi, TalerCorebankApiClient, TransactionType, WireGatewayApiClient, @@ -73,9 +74,23 @@ async function runTestfakeConversionService(): Promise<TestfakeConversionService JSON.stringify({ version: "0:0:0", name: "taler-conversion-info", - regional_currency: {}, - fiat_currency: {}, - }), + regional_currency: "FOO", + fiat_currency: "BAR", + regional_currency_specification: { + alt_unit_names: {}, + name: "FOO", + num_fractional_input_digits: 2, + num_fractional_normal_digits: 2, + num_fractional_trailing_zero_digits: 2, + }, + fiat_currency_specification: { + alt_unit_names: {}, + name: "BAR", + num_fractional_input_digits: 2, + num_fractional_normal_digits: 2, + num_fractional_trailing_zero_digits: 2, + }, + } satisfies TalerBankConversionApi.IntegrationConfig), ); } else if (path === "/cashin-rate") { res.writeHead(200, { "Content-Type": "application/json" }); |