wallet-cli: benchmarking

This commit is contained in:
Florian Dold 2021-10-20 13:06:31 +02:00
parent c3570484a8
commit 589c2a3382
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
74 changed files with 353 additions and 146 deletions

View File

@ -0,0 +1,89 @@
/*
This file is part of GNU Taler
(C) 2021 Taler Systems S.A.
GNU Taler is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later version.
GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
* Imports.
*/
import { buildCodecForObject, codecForString } from "@gnu-taler/taler-util";
import {
getDefaultNodeWallet,
NodeHttpLib,
WalletApiOperation,
} from "@gnu-taler/taler-wallet-core";
/**
* Entry point for the benchmark.
*
* The benchmark runs against an existing Taler deployment and does not
* set up its own services.
*/
export async function runBench1(configJson: any): Promise<void> {
// Validate the configuration file for this benchmark.
const b1conf = codecForBench1Config().decode(configJson);
const myHttpLib = new NodeHttpLib();
const wallet = await getDefaultNodeWallet({
// No persistent DB storage.
persistentStoragePath: undefined,
httpLib: myHttpLib,
});
await wallet.client.call(WalletApiOperation.InitWallet, {});
await wallet.client.call(WalletApiOperation.WithdrawFakebank, {
amount: "TESTKUDOS:10",
bank: b1conf.bank,
exchange: b1conf.exchange,
});
await wallet.runTaskLoop({
stopWhenDone: true,
});
await wallet.client.call(WalletApiOperation.CreateDepositGroup, {
amount: "TESTKUDOS:5",
depositPaytoUri: "payto://x-taler-bank/localhost/foo",
});
await wallet.runTaskLoop({
stopWhenDone: true,
});
wallet.stop();
}
/**
* Format of the configuration file passed to the benchmark
*/
interface Bench1Config {
/**
* Base URL of the bank.
*/
bank: string;
/**
* Base URL of the exchange.
*/
exchange: string;
}
/**
* Schema validation codec for Bench1Config.
*/
const codecForBench1Config = () =>
buildCodecForObject<Bench1Config>()
.property("bank", codecForString())
.property("exchange", codecForString())
.build("Bench1Config");

View File

@ -0,0 +1,68 @@
/*
This file is part of GNU Taler
(C) 2021 Taler Systems S.A.
GNU Taler is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later version.
GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
* Imports.
*/
import { URL } from "@gnu-taler/taler-util";
import { CoinConfig, defaultCoinConfig } from "./harness/denomStructures.js";
import {
GlobalTestState,
setupDb,
FakeBankService,
ExchangeService,
} from "./harness/harness.js";
/**
* Entry point for the benchmark.
*
* The benchmark runs against an existing Taler deployment and does not
* set up its own services.
*/
export async function runEnv1(t: GlobalTestState): Promise<void> {
const db = await setupDb(t);
const bank = await FakeBankService.create(t, {
currency: "TESTKUDOS",
httpPort: 8082,
});
const exchange = ExchangeService.create(t, {
name: "testexchange-1",
currency: "TESTKUDOS",
httpPort: 8081,
database: db.connStr,
});
exchange.addBankAccount("1", {
accountName: "exchange",
accountPassword: "x",
wireGatewayApiBaseUrl: new URL("/exchange/", bank.baseUrl).href,
accountPaytoUri: "payto://x-taler-bank/localhost/exchange",
});
await bank.start();
await bank.pingUntilAvailable();
const coinConfig: CoinConfig[] = defaultCoinConfig.map((x) => x("TESTKUDOS"));
exchange.addCoinConfigList(coinConfig);
await exchange.start();
await exchange.pingUntilAvailable();
console.log("setup done!");
}

View File

@ -31,7 +31,7 @@ import {
ExchangeServiceInterface,
MerchantServiceInterface,
MerchantService,
} from "./harness";
} from "../harness/harness.js";
export interface FaultProxyConfig {
inboundPort: number;

View File

@ -28,6 +28,7 @@ import * as util from "util";
import * as fs from "fs";
import * as path from "path";
import * as http from "http";
import * as readline from "readline";
import { deepStrictEqual } from "assert";
import { ChildProcess, spawn } from "child_process";
import { URL } from "url";
@ -1626,6 +1627,7 @@ export async function runTestWithState(
gc: GlobalTestState,
testMain: (t: GlobalTestState) => Promise<void>,
testName: string,
linger: boolean = false,
): Promise<TestRunResult> {
const startMs = new Date().getTime();
@ -1649,6 +1651,19 @@ export async function runTestWithState(
console.log("running test in directory", gc.testDir);
await Promise.race([testMain(gc), p.promise]);
status = "pass";
if (linger) {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: true,
});
await new Promise<void>((resolve, reject) => {
rl.question("Press enter to shut down test.", () => {
resolve();
});
});
rl.close();
}
} catch (e) {
console.error("FATAL: test failed with exception", e);
status = "fail";

View File

@ -19,7 +19,7 @@
*/
import axios from "axios";
import { URL } from "@gnu-taler/taler-util";
import { getRandomIban, getRandomString } from "./helpers";
import { getRandomIban, getRandomString } from "../harness/helpers.js";
import {
GlobalTestState,
DbInfo,
@ -28,7 +28,7 @@ import {
runCommand,
setupDb,
sh,
} from "./harness";
} from "../harness/harness.js";
export interface LibeufinSandboxServiceInterface {
baseUrl: string;

View File

@ -24,7 +24,7 @@ import {
GlobalTestState,
pingProc,
ProcessWrapper,
} from "./harness";
} from "../harness/harness.js";
import { Configuration } from "@gnu-taler/taler-util";
const exec = util.promisify(require("child_process").exec);

View File

@ -19,6 +19,7 @@
*/
import os from "os";
import fs from "fs";
import path from "path";
import { deepStrictEqual } from "assert";
// Polyfill for encoding which isn't present globally in older nodejs versions
import { TextEncoder, TextDecoder } from "util";
@ -56,6 +57,9 @@ import {
Wallet,
} from "@gnu-taler/taler-wallet-core";
import { lintExchangeDeployment } from "./lint.js";
import { runBench1 } from "./bench1.js";
import { runEnv1 } from "./env1.js";
import { GlobalTestState, runTestWithState } from "./harness/harness.js";
// This module also serves as the entry point for the crypto
// thread worker, and thus must expose these two handlers.
@ -634,6 +638,33 @@ const advancedCli = walletCli.subcommand("advancedArgs", "advanced", {
"Subcommands for advanced operations (only use if you know what you're doing!).",
});
advancedCli
.subcommand("bench1", "bench1", {
help: "Run the 'bench1' benchmark",
})
.requiredOption("configJson", ["--config-json"], clk.STRING)
.action(async (args) => {
let config: any;
try {
config = JSON.parse(args.bench1.configJson);
} catch (e) {
console.log("Could not parse config JSON");
}
await runBench1(config);
});
advancedCli
.subcommand("env1", "env1", {
help: "Run a test environment for bench1",
})
.action(async (args) => {
const testDir = fs.mkdtempSync(path.join(os.tmpdir(), "taler-env1-"));
const testState = new GlobalTestState({
testDir,
});
await runTestWithState(testState, runEnv1, "env1", true);
});
advancedCli
.subcommand("withdrawFakebank", "withdraw-fakebank", {
help: "Withdraw via a fakebank.",
@ -642,7 +673,7 @@ advancedCli
help: "Base URL of the exchange to use",
})
.requiredOption("amount", ["--amount"], clk.STRING, {
help: "Amount to withdraw (before fees)."
help: "Amount to withdraw (before fees).",
})
.requiredOption("bank", ["--bank"], clk.STRING, {
help: "Base URL of the Taler fakebank service.",

View File

@ -17,8 +17,8 @@
/**
* Imports.
*/
import { GlobalTestState, MerchantPrivateApi } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "../harness/helpers.js";
/**
* Run test for basic, bank-integrated withdrawal.

View File

@ -27,9 +27,9 @@ import {
BankApi,
BankAccessApi,
CreditDebitIndicator,
} from "./harness";
} from "../harness/harness.js";
import { createEddsaKeyPair, encodeCrock } from "@gnu-taler/taler-util";
import { defaultCoinConfig } from "./denomStructures";
import { defaultCoinConfig } from "../harness/denomStructures";
/**
* Run test for basic, bank-integrated withdrawal.

View File

@ -17,8 +17,8 @@
/**
* Imports.
*/
import { GlobalTestState, MerchantPrivateApi } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "../harness/helpers.js";
import { URL } from "url";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";

View File

@ -27,8 +27,8 @@ import {
WalletApiOperation,
} from "@gnu-taler/taler-wallet-core";
import { makeEventId } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState, MerchantPrivateApi } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "../harness/helpers.js";
export async function runDenomUnofferedTest(t: GlobalTestState) {
// Set up test environment

View File

@ -18,8 +18,8 @@
* Imports.
*/
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
import { GlobalTestState } from "../harness/harness.js";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "../harness/helpers.js";
/**
* Run test for basic, bank-integrated withdrawal and payment.

View File

@ -26,7 +26,7 @@ import {
MerchantService,
BankApi,
BankAccessApi,
} from "./harness";
} from "../harness/harness.js";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import {
ExchangesListRespose,
@ -36,8 +36,8 @@ import {
import {
FaultInjectedExchangeService,
FaultInjectionResponseContext,
} from "./faultInjection";
import { defaultCoinConfig } from "./denomStructures";
} from "../harness/faultInjection";
import { defaultCoinConfig } from "../harness/denomStructures";
/**
* Test if the wallet handles outdated exchange versions correct.y

View File

@ -31,7 +31,7 @@ import {
readSuccessResponseJsonOrThrow,
WalletApiOperation,
} from "@gnu-taler/taler-wallet-core";
import { makeNoFeeCoinConfig } from "./denomStructures";
import { makeNoFeeCoinConfig } from "../harness/denomStructures";
import {
BankService,
ExchangeService,
@ -40,8 +40,8 @@ import {
MerchantService,
setupDb,
WalletCli,
} from "./harness";
import { startWithdrawViaBank, withdrawViaBank } from "./helpers";
} from "../harness/harness.js";
import { startWithdrawViaBank, withdrawViaBank } from "../harness/helpers.js";
async function applyTimeTravel(
timetravelDuration: Duration,

View File

@ -25,12 +25,12 @@ import {
MerchantService,
setupDb,
WalletCli,
} from "./harness";
} from "../harness/harness.js";
import {
withdrawViaBank,
makeTestPayment,
SimpleTestEnvironment,
} from "./helpers";
} from "../harness/helpers.js";
/**
* Run a test case with a simple TESTKUDOS Taler environment, consisting

View File

@ -17,7 +17,7 @@
/**
* Imports.
*/
import { GlobalTestState } from "./harness";
import { GlobalTestState } from "../harness/harness.js";
import {
NexusUserBundle,
LibeufinNexusApi,
@ -25,7 +25,7 @@ import {
LibeufinSandboxService,
LibeufinSandboxApi,
findNexusPayment,
} from "./libeufin";
} from "../harness/libeufin";
/**
* Run basic test with LibEuFin.

View File

@ -17,7 +17,7 @@
/**
* Imports.
*/
import { GlobalTestState } from "./harness";
import { GlobalTestState } from "../harness/harness.js";
import {
NexusUserBundle,
LibeufinNexusApi,
@ -25,7 +25,7 @@ import {
LibeufinSandboxService,
LibeufinSandboxApi,
findNexusPayment,
} from "./libeufin";
} from "../harness/libeufin";
/**
* Run basic test with LibEuFin.

View File

@ -19,13 +19,13 @@
*/
import axios from "axios";
import { URL } from "@gnu-taler/taler-util";
import { GlobalTestState } from "./harness";
import { GlobalTestState } from "../harness/harness.js";
import {
SandboxUserBundle,
NexusUserBundle,
launchLibeufinServices,
LibeufinNexusApi,
} from "./libeufin";
} from "../harness/libeufin";
export async function runLibeufinApiFacadeBadRequestTest(t: GlobalTestState) {

View File

@ -17,13 +17,13 @@
/**
* Imports.
*/
import { GlobalTestState } from "./harness";
import { GlobalTestState } from "../harness/harness.js";
import {
SandboxUserBundle,
NexusUserBundle,
launchLibeufinServices,
LibeufinNexusApi,
} from "./libeufin";
} from "../harness/libeufin";
/**
* Run basic test with LibEuFin.

View File

@ -17,12 +17,12 @@
/**
* Imports.
*/
import { GlobalTestState } from "./harness";
import { GlobalTestState } from "../harness/harness.js";
import {
NexusUserBundle,
LibeufinNexusApi,
LibeufinNexusService,
} from "./libeufin";
} from "../harness/libeufin";
/**
* Run basic test with LibEuFin.

View File

@ -17,7 +17,7 @@
/**
* Imports.
*/
import { GlobalTestState } from "./harness";
import { GlobalTestState } from "../harness/harness.js";
import {
NexusUserBundle,
LibeufinNexusApi,
@ -25,7 +25,7 @@ import {
LibeufinSandboxService,
LibeufinSandboxApi,
findNexusPayment,
} from "./libeufin";
} from "../harness/libeufin";
// This test only checks that LibEuFin doesn't fail when
// it generates Camt statements - no assertions take place.

View File

@ -17,7 +17,7 @@
/**
* Imports.
*/
import { GlobalTestState } from "./harness";
import { GlobalTestState } from "../harness/harness.js";
import {
NexusUserBundle,
LibeufinNexusApi,
@ -25,7 +25,7 @@ import {
LibeufinSandboxService,
LibeufinSandboxApi,
findNexusPayment,
} from "./libeufin";
} from "../harness/libeufin";
export async function runLibeufinApiSandboxTransactionsTest(t: GlobalTestState) {

View File

@ -17,7 +17,7 @@
/**
* Imports.
*/
import { GlobalTestState, setupDb } from "./harness";
import { GlobalTestState, setupDb } from "../harness/harness.js";
import {
SandboxUserBundle,
NexusUserBundle,
@ -25,7 +25,7 @@ import {
LibeufinSandboxApi,
LibeufinNexusApi,
LibeufinNexusService,
} from "./libeufin";
} from "../harness/libeufin";
/**
* Test Nexus scheduling API. It creates a task, check whether it shows
@ -72,7 +72,7 @@ export async function runLibeufinApiSchedulingTest(t: GlobalTestState) {
user01nexus.localAccountName,
"test-task",
);
} catch (err) {
} catch (err: any) {
t.assertTrue(err.response.status == 404);
}
@ -100,7 +100,7 @@ export async function runLibeufinApiSchedulingTest(t: GlobalTestState) {
user01nexus.localAccountName,
"test-task",
);
} catch (err) {
} catch (err: any) {
t.assertTrue(err.response.status == 404);
}
}

View File

@ -17,8 +17,8 @@
/**
* Imports.
*/
import { GlobalTestState } from "./harness";
import { LibeufinNexusApi, LibeufinNexusService } from "./libeufin";
import { GlobalTestState } from "../harness/harness.js";
import { LibeufinNexusApi, LibeufinNexusService } from "../harness/libeufin";
/**
* Run basic test with LibEuFin.

View File

@ -17,13 +17,13 @@
/**
* Imports.
*/
import { GlobalTestState, delayMs } from "./harness";
import { GlobalTestState, delayMs } from "../harness/harness.js";
import {
NexusUserBundle,
LibeufinNexusApi,
LibeufinNexusService,
LibeufinSandboxService,
} from "./libeufin";
} from "../harness/libeufin";
/**
* Testing how Nexus reacts when the Sandbox is unreachable.
@ -65,7 +65,7 @@ export async function runLibeufinBadGatewayTest(t: GlobalTestState) {
libeufinNexus,
user01nexus.connReq.name,
);
} catch(e) {
} catch(e: any) {
t.assertTrue(e.response.status == 502);
return;
}

View File

@ -19,7 +19,7 @@
*/
import { CoreApiResponse } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { CoinConfig, defaultCoinConfig } from "./denomStructures";
import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures";
import {
DbInfo,
HarnessExchangeBankAccount,
@ -28,14 +28,14 @@ import {
MerchantService,
setupDb,
WalletCli,
} from "./harness";
import { makeTestPayment } from "./helpers";
} from "../harness/harness.js";
import { makeTestPayment } from "../harness/helpers.js";
import {
LibeufinNexusApi,
LibeufinNexusService,
LibeufinSandboxApi,
LibeufinSandboxService,
} from "./libeufin";
} from "../harness/libeufin";
const exchangeIban = "DE71500105179674997361";
const customerIban = "DE84500105176881385584";

View File

@ -17,14 +17,14 @@
/**
* Imports.
*/
import { GlobalTestState, delayMs } from "./harness";
import { GlobalTestState, delayMs } from "../harness/harness.js";
import {
SandboxUserBundle,
NexusUserBundle,
launchLibeufinServices,
LibeufinSandboxApi,
LibeufinNexusApi,
} from "./libeufin";
} from "../harness/libeufin";
/**
* This test checks how the C52 and C53 coordinate. It'll test

View File

@ -17,14 +17,14 @@
/**
* Imports.
*/
import { GlobalTestState } from "./harness";
import { GlobalTestState } from "../harness/harness.js";
import {
SandboxUserBundle,
NexusUserBundle,
launchLibeufinServices,
LibeufinNexusApi,
LibeufinSandboxApi,
} from "./libeufin";
} from "../harness/libeufin";
/**
* Testing the Anastasis API, offered by the Anastasis facade.

View File

@ -17,14 +17,14 @@
/**
* Imports.
*/
import { GlobalTestState } from "./harness";
import { GlobalTestState } from "../harness/harness.js";
import {
SandboxUserBundle,
NexusUserBundle,
launchLibeufinServices,
LibeufinSandboxApi,
LibeufinNexusApi,
} from "./libeufin";
} from "../harness/libeufin";
/**
* Run basic test with LibEuFin.

View File

@ -17,14 +17,14 @@
/**
* Imports.
*/
import { GlobalTestState, delayMs } from "./harness";
import { GlobalTestState, delayMs } from "../harness/harness.js";
import {
SandboxUserBundle,
NexusUserBundle,
launchLibeufinServices,
LibeufinSandboxApi,
LibeufinNexusApi,
} from "./libeufin";
} from "../harness/libeufin";
/**
* This test checks how the C52 and C53 coordinate. It'll test

View File

@ -17,14 +17,14 @@
/**
* Imports.
*/
import { GlobalTestState, delayMs } from "./harness";
import { GlobalTestState, delayMs } from "../harness/harness.js";
import {
SandboxUserBundle,
NexusUserBundle,
launchLibeufinServices,
LibeufinSandboxApi,
LibeufinNexusApi,
} from "./libeufin";
} from "../harness/libeufin";
/**
* User 01 expects a refund from user 02, and expectedly user 03

View File

@ -17,14 +17,14 @@
/**
* Imports.
*/
import { GlobalTestState, delayMs } from "./harness";
import { GlobalTestState, delayMs } from "../harness/harness.js";
import {
SandboxUserBundle,
NexusUserBundle,
launchLibeufinServices,
LibeufinSandboxApi,
LibeufinNexusApi,
} from "./libeufin";
} from "../harness/libeufin";
/**
* Run basic test with LibEuFin.

View File

@ -17,7 +17,7 @@
/**
* Imports.
*/
import { GlobalTestState } from "./harness";
import { GlobalTestState } from "../harness/harness.js";
import {
NexusUserBundle,
LibeufinNexusApi,
@ -25,7 +25,7 @@ import {
LibeufinSandboxService,
LibeufinSandboxApi,
findNexusPayment,
} from "./libeufin";
} from "../harness/libeufin";
export async function runLibeufinSandboxWireTransferCliTest(t: GlobalTestState) {

View File

@ -17,12 +17,12 @@
/**
* Imports.
*/
import { GlobalTestState } from "./harness";
import { GlobalTestState } from "../harness/harness.js";
import {
LibeufinNexusService,
LibeufinSandboxService,
LibeufinCli,
} from "./libeufin";
} from "../harness/libeufin";
/**
* Run basic test with LibEuFin.

View File

@ -25,12 +25,12 @@ import {
MerchantService,
setupDb,
WalletCli,
} from "./harness";
} from "../harness/harness.js";
import {
withdrawViaBank,
createFaultInjectedMerchantTestkudosEnvironment,
FaultyMerchantTestEnvironment,
} from "./helpers";
} from "../harness/helpers.js";
import {
PreparePayResultType,
codecForMerchantOrderStatusUnpaid,
@ -41,8 +41,8 @@ import {
FaultInjectedExchangeService,
FaultInjectedMerchantService,
FaultInjectionRequestContext,
} from "./faultInjection";
import { defaultCoinConfig } from "./denomStructures";
} from "../harness/faultInjection";
import { defaultCoinConfig } from "../harness/denomStructures";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { URL } from "url";

View File

@ -25,7 +25,7 @@ import {
MerchantApiClient,
MerchantService,
setupDb,
} from "./harness";
} from "../harness/harness.js";
/**
* Test instance deletion and authentication for it

View File

@ -24,7 +24,7 @@ import {
MerchantApiClient,
MerchantService,
setupDb,
} from "./harness";
} from "../harness/harness.js";
/**
* Do basic checks on instance management and authentication.

View File

@ -25,7 +25,7 @@ import {
MerchantApiClient,
MerchantService,
setupDb,
} from "./harness";
} from "../harness/harness.js";
/**
* Do basic checks on instance management and authentication.

View File

@ -17,8 +17,8 @@
/**
* Imports.
*/
import { GlobalTestState, MerchantPrivateApi } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "../harness/helpers.js";
import {
PreparePayResultType,
codecForMerchantOrderStatusUnpaid,

View File

@ -24,8 +24,8 @@ import {
MerchantServiceInterface,
WalletCli,
ExchangeServiceInterface,
} from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
} from "../harness/harness.js";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "../harness/helpers.js";
import {
URL,
durationFromSpec,

View File

@ -32,11 +32,11 @@ import {
MerchantPrivateApi,
MerchantService,
WalletCli,
} from "./harness";
} from "../harness/harness.js";
import {
createSimpleTestkudosEnvironment,
withdrawViaBank,
} from "./helpers.js";
} from "../harness/helpers.js";
const httpLib = new NodeHttpLib();

View File

@ -27,12 +27,12 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import {
FaultInjectionRequestContext,
FaultInjectionResponseContext,
} from "./faultInjection";
import { GlobalTestState, MerchantPrivateApi, setupDb } from "./harness";
} from "../harness/faultInjection";
import { GlobalTestState, MerchantPrivateApi, setupDb } from "../harness/harness.js";
import {
createFaultInjectedMerchantTestkudosEnvironment,
withdrawViaBank,
} from "./helpers";
} from "../harness/helpers.js";
/**
* Run test for basic, bank-integrated withdrawal.

View File

@ -17,11 +17,11 @@
/**
* Imports.
*/
import { GlobalTestState, MerchantPrivateApi } from "./harness";
import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js";
import {
withdrawViaBank,
createFaultInjectedMerchantTestkudosEnvironment,
} from "./helpers";
} from "../harness/helpers.js";
import {
PreparePayResultType,
codecForMerchantOrderStatusUnpaid,
@ -29,7 +29,7 @@ import {
URL,
} from "@gnu-taler/taler-util";
import axios from "axios";
import { FaultInjectionRequestContext } from "./faultInjection";
import { FaultInjectionRequestContext } from "../harness/faultInjection";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
/**

View File

@ -17,8 +17,8 @@
/**
* Imports.
*/
import { GlobalTestState, MerchantPrivateApi, WalletCli } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
import { GlobalTestState, MerchantPrivateApi, WalletCli } from "../harness/harness.js";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "../harness/helpers.js";
import { PreparePayResultType } from "@gnu-taler/taler-util";
import { TalerErrorCode } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";

View File

@ -31,14 +31,14 @@ import {
MerchantPrivateApi,
BankApi,
BankAccessApi,
} from "./harness";
} from "../harness/harness.js";
import {
FaultInjectedExchangeService,
FaultInjectionRequestContext,
FaultInjectionResponseContext,
} from "./faultInjection";
} from "../harness/faultInjection";
import { CoreApiResponse } from "@gnu-taler/taler-util";
import { defaultCoinConfig } from "./denomStructures";
import { defaultCoinConfig } from "../harness/denomStructures";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
/**

View File

@ -17,12 +17,12 @@
/**
* Imports.
*/
import { GlobalTestState } from "./harness";
import { GlobalTestState } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironment,
withdrawViaBank,
makeTestPayment,
} from "./helpers";
} from "../harness/helpers.js";
/**
* Run test for payment with a contract that has forgettable fields.

View File

@ -17,8 +17,8 @@
/**
* Imports.
*/
import { GlobalTestState, MerchantPrivateApi } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "../harness/helpers.js";
import { PreparePayResultType } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";

View File

@ -25,9 +25,9 @@ import {
MerchantService,
WalletCli,
MerchantPrivateApi,
} from "./harness";
import { withdrawViaBank } from "./helpers";
import { coin_ct10, coin_u1 } from "./denomStructures";
} from "../harness/harness.js";
import { withdrawViaBank } from "../harness/helpers.js";
import { coin_ct10, coin_u1 } from "../harness/denomStructures";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
async function setupTest(

View File

@ -22,10 +22,10 @@ import {
BankApi,
WalletCli,
BankAccessApi
} from "./harness";
} from "../harness/harness.js";
import {
makeTestPayment,
} from "./helpers";
} from "../harness/helpers.js";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
/**

View File

@ -17,16 +17,16 @@
/**
* Imports.
*/
import { GlobalTestState, MerchantPrivateApi } from "./harness";
import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js";
import {
withdrawViaBank,
createFaultInjectedMerchantTestkudosEnvironment,
} from "./helpers";
} from "../harness/helpers.js";
import axios from "axios";
import {
FaultInjectionRequestContext,
FaultInjectionResponseContext,
} from "./faultInjection";
} from "../harness/faultInjection";
import {
codecForMerchantOrderStatusUnpaid,
ConfirmPayResultType,

View File

@ -18,12 +18,12 @@
* Imports.
*/
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState } from "./harness";
import { GlobalTestState } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironment,
withdrawViaBank,
makeTestPayment,
} from "./helpers";
} from "../harness/helpers.js";
/**
* Run test for a payment for a "free" order with

View File

@ -17,12 +17,12 @@
/**
* Imports.
*/
import { GlobalTestState } from "./harness";
import { GlobalTestState } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironment,
withdrawViaBank,
makeTestPayment,
} from "./helpers";
} from "../harness/helpers.js";
/**
* Run test for basic, bank-integrated withdrawal and payment.

View File

@ -17,8 +17,8 @@
/**
* Imports.
*/
import { GlobalTestState, MerchantPrivateApi } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "../harness/helpers.js";
import {
PreparePayResultType,
codecForMerchantOrderStatusUnpaid,

View File

@ -17,8 +17,8 @@
/**
* Imports.
*/
import { GlobalTestState, MerchantPrivateApi } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "../harness/helpers.js";
import { durationFromSpec } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";

View File

@ -17,12 +17,12 @@
/**
* Imports.
*/
import { GlobalTestState, MerchantPrivateApi } from "./harness";
import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironment,
withdrawViaBank,
applyTimeTravel,
} from "./helpers";
} from "../harness/helpers.js";
import {
durationFromSpec,
timestampAddDuration,

View File

@ -17,8 +17,8 @@
/**
* Imports.
*/
import { GlobalTestState, delayMs, MerchantPrivateApi } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
import { GlobalTestState, delayMs, MerchantPrivateApi } from "../harness/harness.js";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "../harness/helpers.js";
import {
TransactionType,
Amounts,

View File

@ -19,8 +19,8 @@
*/
import { durationFromSpec } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState, MerchantPrivateApi } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "../harness/helpers.js";
/**
* Run test for basic, bank-integrated withdrawal.

View File

@ -18,7 +18,7 @@
* Imports.
*/
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { CoinConfig } from "./denomStructures";
import { CoinConfig } from "../harness/denomStructures";
import {
GlobalTestState,
ExchangeService,
@ -27,12 +27,12 @@ import {
setupDb,
BankService,
delayMs,
} from "./harness";
} from "../harness/harness.js";
import {
withdrawViaBank,
makeTestPayment,
SimpleTestEnvironment,
} from "./helpers";
} from "../harness/helpers.js";
async function revokeAllWalletCoins(req: {
wallet: WalletCli;

View File

@ -27,7 +27,7 @@ import {
PendingOperationsResponse,
WalletApiOperation,
} from "@gnu-taler/taler-wallet-core";
import { makeNoFeeCoinConfig } from "./denomStructures";
import { makeNoFeeCoinConfig } from "../harness/denomStructures";
import {
BankService,
ExchangeService,
@ -36,8 +36,8 @@ import {
MerchantService,
setupDb,
WalletCli,
} from "./harness";
import { startWithdrawViaBank, withdrawViaBank } from "./helpers";
} from "../harness/harness.js";
import { startWithdrawViaBank, withdrawViaBank } from "../harness/helpers.js";
async function applyTimeTravel(
timetravelDuration: Duration,

View File

@ -17,12 +17,12 @@
/**
* Imports.
*/
import { GlobalTestState } from "./harness";
import { GlobalTestState } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironment,
withdrawViaBank,
startWithdrawViaBank,
} from "./helpers";
} from "../harness/helpers.js";
import { Duration, TransactionType } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";

View File

@ -18,8 +18,8 @@
* Imports.
*/
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState, MerchantPrivateApi, BankApi } from "./harness";
import { createSimpleTestkudosEnvironment } from "./helpers";
import { GlobalTestState, MerchantPrivateApi, BankApi } from "../harness/harness.js";
import { createSimpleTestkudosEnvironment } from "../harness/helpers.js";
/**
* Run test for basic, bank-integrated withdrawal.

View File

@ -18,9 +18,9 @@
* Imports.
*/
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState, WalletCli } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
import { SyncService } from "./sync";
import { GlobalTestState, WalletCli } from "../harness/harness.js";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "../harness/helpers.js";
import { SyncService } from "../harness/sync";
/**
* Run test for basic, bank-integrated withdrawal.

View File

@ -19,13 +19,13 @@
*/
import { PreparePayResultType } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState, WalletCli, MerchantPrivateApi } from "./harness";
import { GlobalTestState, WalletCli, MerchantPrivateApi } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironment,
makeTestPayment,
withdrawViaBank,
} from "./helpers";
import { SyncService } from "./sync";
} from "../harness/helpers.js";
import { SyncService } from "../harness/sync";
/**
* Run test for basic, bank-integrated withdrawal.

View File

@ -24,7 +24,7 @@
*/
import { Amounts } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { CoinConfig, defaultCoinConfig } from "./denomStructures.js";
import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js";
import {
BankService,
ExchangeService,
@ -32,8 +32,8 @@ import {
MerchantService,
setupDb,
WalletCli,
} from "./harness.js";
import { SimpleTestEnvironment } from "./helpers.js";
} from "../harness/harness.js";
import { SimpleTestEnvironment } from "../harness/helpers.js";
const merchantAuthToken = "secret-token:sandbox";

View File

@ -19,8 +19,8 @@
*/
import { TalerErrorCode } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState, BankApi, BankAccessApi } from "./harness";
import { createSimpleTestkudosEnvironment } from "./helpers";
import { GlobalTestState, BankApi, BankAccessApi } from "../harness/harness.js";
import { createSimpleTestkudosEnvironment } from "../harness/helpers.js";
/**
* Run test for basic, bank-integrated withdrawal.

View File

@ -17,8 +17,8 @@
/**
* Imports.
*/
import { GlobalTestState, BankApi, BankAccessApi } from "./harness";
import { createSimpleTestkudosEnvironment } from "./helpers";
import { GlobalTestState, BankApi, BankAccessApi } from "../harness/harness.js";
import { createSimpleTestkudosEnvironment } from "../harness/helpers.js";
import { codecForBalancesResponse } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";

View File

@ -24,10 +24,10 @@ import {
setupDb,
ExchangeService,
FakeBankService,
} from "./harness";
import { createSimpleTestkudosEnvironment } from "./helpers";
} from "../harness/harness.js";
import { createSimpleTestkudosEnvironment } from "../harness/helpers.js";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { CoinConfig, defaultCoinConfig } from "./denomStructures.js";
import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js";
import { URL } from "@gnu-taler/taler-util";
/**

View File

@ -17,8 +17,8 @@
/**
* Imports.
*/
import { GlobalTestState, BankApi } from "./harness";
import { createSimpleTestkudosEnvironment } from "./helpers";
import { GlobalTestState, BankApi } from "../harness/harness.js";
import { createSimpleTestkudosEnvironment } from "../harness/helpers.js";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
/**

View File

@ -22,7 +22,7 @@ import {
runTestWithState,
shouldLingerInTest,
TestRunResult,
} from "./harness";
} from "../harness/harness.js";
import { runPaymentTest } from "./test-payment";
import { runPaymentDemoTest } from "./test-payment-on-demo";
import * as fs from "fs";

View File

@ -43,7 +43,7 @@ import {
} from "@gnu-taler/taler-wallet-core";
import { URL } from "url";
import { spawn } from "child_process";
import { delayMs } from "./integrationtests/harness.js";
import { delayMs } from "./harness/harness.js";
interface BasicConf {
mainCurrency: string;

View File

@ -118,6 +118,10 @@ export enum WalletApiOperation {
}
export type WalletOperations = {
[WalletApiOperation.InitWallet]: {
request: {};
response: {};
};
[WalletApiOperation.WithdrawFakebank]: {
request: WithdrawFakebankRequest;
response: {};