[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: wallet: fix withdrawal in tim
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: wallet: fix withdrawal in timetravel test |
Date: |
Mon, 07 Mar 2022 23:57:28 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new 3aa0b812 wallet: fix withdrawal in timetravel test
3aa0b812 is described below
commit 3aa0b812f476791b3c3feddb1421e212cf981b3c
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Mar 7 23:57:25 2022 +0100
wallet: fix withdrawal in timetravel test
---
packages/taler-wallet-cli/src/harness/helpers.ts | 44 +++++++++++-----------
.../integrationtests/test-timetravel-withdraw.ts | 20 +++++-----
2 files changed, 34 insertions(+), 30 deletions(-)
diff --git a/packages/taler-wallet-cli/src/harness/helpers.ts
b/packages/taler-wallet-cli/src/harness/helpers.ts
index a5d3b315..f19c6a11 100644
--- a/packages/taler-wallet-cli/src/harness/helpers.ts
+++ b/packages/taler-wallet-cli/src/harness/helpers.ts
@@ -23,36 +23,36 @@
/**
* Imports
*/
-import {
- FaultInjectedExchangeService,
- FaultInjectedMerchantService,
-} from "./faultInjection";
-import { CoinConfig, defaultCoinConfig } from "./denomStructures";
import {
AmountString,
- Duration,
+ ConfirmPayResultType,
ContractTerms,
+ Duration,
PreparePayResultType,
- ConfirmPayResultType,
} from "@gnu-taler/taler-util";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
+import { CoinConfig, defaultCoinConfig } from "./denomStructures.js";
import {
- DbInfo,
+ FaultInjectedExchangeService,
+ FaultInjectedMerchantService,
+} from "./faultInjection.js";
+import {
+ BankAccessApi,
+ BankApi,
BankService,
+ DbInfo,
ExchangeService,
- MerchantService,
- WalletCli,
- GlobalTestState,
- setupDb,
ExchangeServiceInterface,
- BankApi,
- BankAccessApi,
- MerchantServiceInterface,
- MerchantPrivateApi,
+ getPayto,
+ GlobalTestState,
HarnessExchangeBankAccount,
+ MerchantPrivateApi,
+ MerchantService,
+ MerchantServiceInterface,
+ setupDb,
+ WalletCli,
WithAuthorization,
- getPayto,
} from "./harness.js";
-import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
export interface SimpleTestEnvironment {
commonDb: DbInfo;
@@ -242,7 +242,9 @@ export async function
createFaultInjectedMerchantTestkudosEnvironment(
}
/**
- * Withdraw balance.
+ * Start withdrawing into the wallet.
+ *
+ * Only starts the operation, does not wait for it to finish.
*/
export async function startWithdrawViaBank(
t: GlobalTestState,
@@ -277,8 +279,8 @@ export async function startWithdrawViaBank(
await BankApi.confirmWithdrawalOperation(bank, user, wop);
- await wallet.runPending();
- await wallet.runUntilDone();
+ // We do *not* call runPending / runUntilDone on the wallet here.
+ // Some tests rely on the final withdraw failing.
}
/**
diff --git
a/packages/taler-wallet-cli/src/integrationtests/test-timetravel-withdraw.ts
b/packages/taler-wallet-cli/src/integrationtests/test-timetravel-withdraw.ts
index 2ff85705..9335af9f 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-timetravel-withdraw.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-timetravel-withdraw.ts
@@ -17,14 +17,14 @@
/**
* Imports.
*/
+import { Duration, TransactionType } from "@gnu-taler/taler-util";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironment,
- withdrawViaBank,
startWithdrawViaBank,
+ withdrawViaBank,
} from "../harness/helpers.js";
-import { Duration, TransactionType } from "@gnu-taler/taler-util";
-import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
/**
* Basic time travel test.
@@ -32,12 +32,8 @@ import { WalletApiOperation } from
"@gnu-taler/taler-wallet-core";
export async function runTimetravelWithdrawTest(t: GlobalTestState) {
// Set up test environment
- const {
- wallet,
- bank,
- exchange,
- merchant,
- } = await createSimpleTestkudosEnvironment(t);
+ const { wallet, bank, exchange, merchant } =
+ await createSimpleTestkudosEnvironment(t);
// Withdraw digital cash into the wallet.
@@ -61,6 +57,8 @@ export async function runTimetravelWithdrawTest(t:
GlobalTestState) {
await merchant.start();
await merchant.pingUntilAvailable();
+ console.log("starting withdrawal via bank");
+
// This should fail, as the wallet didn't time travel yet.
await startWithdrawViaBank(t, {
wallet,
@@ -69,9 +67,13 @@ export async function runTimetravelWithdrawTest(t:
GlobalTestState) {
amount: "TESTKUDOS:20",
});
+ console.log("starting withdrawal done");
+
// Check that transactions are correct for the failed withdrawal
{
+ console.log("running until done (should run into maxRetries limit)");
await wallet.runUntilDone({ maxRetries: 5 });
+ console.log("wallet done running");
const transactions = await wallet.client.call(
WalletApiOperation.GetTransactions,
{},
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: wallet: fix withdrawal in timetravel test,
gnunet <=