commit 4cae19995a2070046174be95fa5fa481f85d3903
parent 8d66f33f857daf6272aed4aea1531412758872c1
Author: Florian Dold <florian@dold.me>
Date: Tue, 29 Apr 2025 14:25:53 +0200
harness: fix timing-related flakiness in withdrawal-cashacceptor test
Diffstat:
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-cashacceptor.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-cashacceptor.ts
@@ -21,6 +21,8 @@ import {
j2s,
succeedOrThrow,
TalerCoreBankHttpClient,
+ TransactionMajorState,
+ TransactionMinorState,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import {
@@ -71,9 +73,22 @@ export async function runWithdrawalCashacceptorTest(t: GlobalTestState) {
// Withdraw
- await walletClient.call(WalletApiOperation.AcceptBankIntegratedWithdrawal, {
- exchangeBaseUrl: exchange.baseUrl,
- talerWithdrawUri,
+ const acceptResp = await walletClient.call(
+ WalletApiOperation.AcceptBankIntegratedWithdrawal,
+ {
+ exchangeBaseUrl: exchange.baseUrl,
+ talerWithdrawUri,
+ },
+ );
+
+ // We need to wait until the wallet has registered the reserve information
+ // with the bank, as the bank will refuse to confirm before that.
+ await walletClient.call(WalletApiOperation.TestingWaitTransactionState, {
+ transactionId: acceptResp.transactionId,
+ txState: {
+ major: TransactionMajorState.Pending,
+ minor: TransactionMinorState.BankConfirmTransfer,
+ },
});
const txns = await walletClient.call(
@@ -82,7 +97,7 @@ export async function runWithdrawalCashacceptorTest(t: GlobalTestState) {
);
console.log(`transactions: ${j2s(txns)}`);
- const bankConfirmResp = succeedOrThrow(
+ succeedOrThrow(
await bankClientNg.confirmWithdrawalById(
bankUser,
{