commit 2debb4f0bd2624cd4eac3aa40728825c3c753a44
parent 658d9f309c1336ab84d57c7defd5dab33b2c19e0
Author: Antoine A <>
Date: Wed, 16 Apr 2025 10:59:17 +0200
harness: add test-dir option and fix peer pull
Diffstat:
4 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -6,6 +6,7 @@ node_modules/
tsconfig.tsbuildinfo
.pnpm-store/
build/
+test/
# GNU-style build system
configure
diff --git a/packages/taler-harness/src/index.ts b/packages/taler-harness/src/index.ts
@@ -1470,6 +1470,9 @@ talerHarnessCli
.maybeOption("suites", ["--suites"], clk.STRING, {
help: "Only run selected suites (comma-separated list)",
})
+ .maybeOption("testDir", ["--test-dir"], clk.STRING, {
+ help: "When to run the tests",
+ })
.flag("dryRun", ["--dry"], {
help: "Only print tests that will be selected to run.",
})
@@ -1498,6 +1501,7 @@ talerHarnessCli
verbosity: args.runIntegrationtests.quiet ? 0 : 1,
includeExperimental: args.runIntegrationtests.experimental ?? false,
noTimeout: args.runIntegrationtests.noTimeout,
+ testDir: args.runIntegrationtests.testDir
});
});
diff --git a/packages/taler-harness/src/integrationtests/testrunner.ts b/packages/taler-harness/src/integrationtests/testrunner.ts
@@ -315,6 +315,7 @@ const allTests: TestMainFunction[] = [
export interface TestRunSpec {
includePattern?: string;
suiteSpec?: string;
+ testDir?: string,
dryRun?: boolean;
failFast?: boolean;
waitOnFail?: boolean;
@@ -394,10 +395,20 @@ export async function runTests(spec: TestRunSpec) {
} else {
logger.info("keeping shared test environment");
}
-
- const testRootDir = fs.mkdtempSync(
- path.join(os.tmpdir(), "taler-integrationtests-"),
- );
+ let testRootDir: string;
+ if (spec.testDir != null) {
+ testRootDir = spec.testDir;
+ try {
+ fs.rmSync(testRootDir, { recursive: true, force: true });
+ } catch (e) {
+ // Ignore
+ }
+ fs.mkdirSync(testRootDir)
+ } else {
+ testRootDir = fs.mkdtempSync(
+ path.join(os.tmpdir(), "taler-integrationtests-"),
+ )
+ }
updateCurrentSymlink(testRootDir);
console.log(`testsuite root directory: ${testRootDir}`);
diff --git a/packages/taler-wallet-core/src/pay-peer-pull-debit.ts b/packages/taler-wallet-core/src/pay-peer-pull-debit.ts
@@ -523,12 +523,9 @@ async function processPeerPullDebitPendingDeposit(
wex,
peerPullInc.peerPullDebitId,
);
+ const { pursePub, coinSel } = peerPullInc;
- const pursePub = peerPullInc.pursePub;
-
- const coinSel = peerPullInc.coinSel;
-
- if (!coinSel) {
+ if (coinSel == null) {
const instructedAmount = Amounts.parseOrThrow(peerPullInc.amount);
const coinSelRes = await selectPeerCoins(wex, {
@@ -560,8 +557,7 @@ async function processPeerPullDebitPendingDeposit(
const totalAmount = await getTotalPeerPaymentCost(wex, coins);
// FIXME: Missing notification here!
- let transitionDone = false;
- await ctx.transition(
+ const info = await ctx.transition(
{
extraStores: [
"coinAvailability",
@@ -574,7 +570,7 @@ async function processPeerPullDebitPendingDeposit(
],
},
async (rec, tx) => {
- if (rec.status !== PeerPullDebitRecordStatus.PendingDeposit || rec.coinSel == null) {
+ if (rec.status !== PeerPullDebitRecordStatus.PendingDeposit || rec.coinSel != null) {
return TransitionResultType.Stay;
}
await spendCoins(wex, tx, {
@@ -590,11 +586,10 @@ async function processPeerPullDebitPendingDeposit(
contributions: coinSelRes.result.coins.map((x) => x.contribution),
totalCost: Amounts.stringify(totalAmount),
};
- transitionDone = true;
return TransitionResultType.Transition;
},
);
- if (transitionDone) {
+ if (info != null) {
return TaskRunResult.progress();
} else {
return TaskRunResult.backoff();