diff options
Diffstat (limited to 'packages/taler-harness')
-rw-r--r-- | packages/taler-harness/src/harness/harness.ts | 6 | ||||
-rw-r--r-- | packages/taler-harness/src/harness/helpers.ts | 2 | ||||
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-payment-expired.ts | 30 |
3 files changed, 36 insertions, 2 deletions
diff --git a/packages/taler-harness/src/harness/harness.ts b/packages/taler-harness/src/harness/harness.ts index b5197afd7..7c54c0c47 100644 --- a/packages/taler-harness/src/harness/harness.ts +++ b/packages/taler-harness/src/harness/harness.ts @@ -384,7 +384,11 @@ export class GlobalTestState { logger.warn(`could not start process (${command})`, err); }); proc.on("exit", (code, signal) => { - logger.warn(`process ${logName} exited ${j2s({ code, signal })}`); + if (code == 0 && signal == null) { + logger.info(`process ${logName} exited with success`); + } else { + logger.warn(`process ${logName} exited ${j2s({ code, signal })}`); + } }); const stderrLogFileName = this.testDir + `/${logName}-stderr.log`; const stderrLog = fs.createWriteStream(stderrLogFileName, { diff --git a/packages/taler-harness/src/harness/helpers.ts b/packages/taler-harness/src/harness/helpers.ts index 39d411a46..ece003e1b 100644 --- a/packages/taler-harness/src/harness/helpers.ts +++ b/packages/taler-harness/src/harness/helpers.ts @@ -624,7 +624,7 @@ export async function applyTimeTravelV2( } if (s.walletClient) { - s.walletClient.call(WalletApiOperation.TestingSetTimetravel, { + await s.walletClient.call(WalletApiOperation.TestingSetTimetravel, { offsetMs: timetravelOffsetMs, }); } diff --git a/packages/taler-harness/src/integrationtests/test-payment-expired.ts b/packages/taler-harness/src/integrationtests/test-payment-expired.ts index e4034108f..4817efba5 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-expired.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-expired.ts @@ -20,14 +20,17 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState, MerchantApiClient } from "../harness/harness.js"; import { + applyTimeTravelV2, createSimpleTestkudosEnvironmentV2, withdrawViaBankV2, } from "../harness/helpers.js"; import { AbsoluteTime, + ConfirmPayResultType, Duration, MerchantContractTerms, PreparePayResultType, + j2s, } from "@gnu-taler/taler-util"; /** @@ -95,6 +98,33 @@ export async function runPaymentExpiredTest(t: GlobalTestState) { preparePayResult.status, PreparePayResultType.PaymentPossible, ); + + await applyTimeTravelV2( + Duration.toMilliseconds(Duration.fromSpec({ hours: 1 })), + { walletClient, exchange, merchant }, + ); + + const confirmPayResult = await walletClient.call( + WalletApiOperation.ConfirmPay, + { transactionId: preparePayResult.transactionId }, + ); + console.log("confirm pay result:"); + console.log(j2s(confirmPayResult)); + t.assertDeepEqual(confirmPayResult.type, ConfirmPayResultType.Pending); + await walletClient.call(WalletApiOperation.AbortTransaction, { + transactionId: preparePayResult.transactionId, + }); + await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); + + const bal = await walletClient.call(WalletApiOperation.GetBalances, {}); + console.log(bal); + + t.assertAmountEquals(bal.balances[0].available, "TESTKUDOS:18.93"); + + const txns = await walletClient.call(WalletApiOperation.GetTransactions, { + includeRefreshes: true, + }); + console.log(j2s(txns)); } runPaymentExpiredTest.suites = ["wallet"]; |