aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-06-20 16:19:53 +0200
committerFlorian Dold <florian@dold.me>2023-06-20 16:19:57 +0200
commit1f60ac76f920da9c710c4a6116741f4412350f4a (patch)
treec461f6efb0e2ccb841fe0dec3cf5993edafd946e
parent773712419e7663f62a3c529b7743dd6964f0879a (diff)
harness: fix test-peer-repair
-rw-r--r--packages/taler-harness/src/integrationtests/test-peer-repair.ts45
1 files changed, 35 insertions, 10 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-peer-repair.ts b/packages/taler-harness/src/integrationtests/test-peer-repair.ts
index cfa7ec877..b09bff2dc 100644
--- a/packages/taler-harness/src/integrationtests/test-peer-repair.ts
+++ b/packages/taler-harness/src/integrationtests/test-peer-repair.ts
@@ -61,7 +61,8 @@ export async function runPeerRepairTest(t: GlobalTestState) {
const wallet2 = w2.walletClient;
const withdrawalDoneCond = wallet1.waitForNotificationCond(
- (x) => x.type === NotificationType.TransactionStateTransition &&
+ (x) =>
+ x.type === NotificationType.TransactionStateTransition &&
x.newTxState.major === TransactionMajorState.Done &&
x.transactionId.startsWith("txn:withdrawal:"),
);
@@ -102,7 +103,7 @@ export async function runPeerRepairTest(t: GlobalTestState) {
x.type === NotificationType.TransactionStateTransition &&
x.transactionId === resp1.transactionId &&
x.newTxState.major === TransactionMajorState.Pending &&
- x.newTxState.minor === TransactionMinorState.Ready
+ x.newTxState.minor === TransactionMinorState.Ready,
);
await peerPushDebitReady1Cond;
@@ -128,12 +129,9 @@ export async function runPeerRepairTest(t: GlobalTestState) {
x.newTxState.major === TransactionMajorState.Done,
);
- await wallet2.client.call(
- WalletApiOperation.ConfirmPeerPushCredit,
- {
- peerPushPaymentIncomingId: resp2.peerPushPaymentIncomingId,
- },
- );
+ await wallet2.client.call(WalletApiOperation.ConfirmPeerPushCredit, {
+ peerPushPaymentIncomingId: resp2.peerPushPaymentIncomingId,
+ });
await peerPushCreditDone1Cond;
await peerPushDebitDone1Cond;
@@ -154,6 +152,8 @@ export async function runPeerRepairTest(t: GlobalTestState) {
});
wallet1 = w1.walletClient;
+ console.log("attempting peer-push-debit, should fail.");
+
const initResp2 = await wallet1.client.call(
WalletApiOperation.InitiatePeerPushDebit,
{
@@ -166,12 +166,37 @@ export async function runPeerRepairTest(t: GlobalTestState) {
},
);
+ const peerPushDebitFailingCond = wallet1.waitForNotificationCond(
+ (x) =>
+ x.type === NotificationType.TransactionStateTransition &&
+ x.transactionId === initResp2.transactionId &&
+ x.newTxState.major === TransactionMajorState.Pending &&
+ x.errorInfo != null,
+ );
+
+ console.log(`waiting for error on ${initResp2.transactionId}`);
+
+ await peerPushDebitFailingCond;
+
+ console.log("reached error");
+
+ // Now withdraw so we have enough coins to re-select
+
+ const withdraw2Res = await withdrawViaBankV2(t, {
+ walletClient: wallet1,
+ bank,
+ exchange,
+ amount: "TESTKUDOS:5",
+ });
+
+ await withdraw2Res.withdrawalFinishedCond;
+
const peerPushDebitReady2Cond = wallet1.waitForNotificationCond(
(x) =>
x.type === NotificationType.TransactionStateTransition &&
- x.transactionId === resp1.transactionId &&
+ x.transactionId === initResp2.transactionId &&
x.newTxState.major === TransactionMajorState.Pending &&
- x.newTxState.minor === TransactionMinorState.Ready
+ x.newTxState.minor === TransactionMinorState.Ready,
);
await peerPushDebitReady2Cond;