diff options
Diffstat (limited to 'packages/taler-harness/src/integrationtests')
11 files changed, 60 insertions, 23 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts b/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts index 561a10e6d..38cbd6925 100644 --- a/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts +++ b/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts @@ -166,6 +166,7 @@ export async function runAgeRestrictionsMerchantTest(t: GlobalTestState) { wireGatewayApiBaseUrl: exchangeBankAccount.wireGatewayApiBaseUrl, accountName: exchangeBankAccount.accountName, accountPassword: exchangeBankAccount.accountPassword, + allowHttp: true, }); await wireGatewayApiClient.adminAddIncoming({ diff --git a/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts b/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts index d129a5217..0bb811f39 100644 --- a/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts +++ b/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts @@ -18,9 +18,7 @@ * Imports. */ import { AbsoluteTime, Duration } from "@gnu-taler/taler-util"; -import { - WalletApiOperation, -} from "@gnu-taler/taler-wallet-core"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { GlobalTestState, WalletCli } from "../harness/harness.js"; import { diff --git a/packages/taler-harness/src/integrationtests/test-bank-api.ts b/packages/taler-harness/src/integrationtests/test-bank-api.ts index d97860a2c..5e3448625 100644 --- a/packages/taler-harness/src/integrationtests/test-bank-api.ts +++ b/packages/taler-harness/src/integrationtests/test-bank-api.ts @@ -126,6 +126,7 @@ export async function runBankApiTest(t: GlobalTestState) { wireGatewayApiBaseUrl: exchangeBankAccount.wireGatewayApiBaseUrl, accountName: exchangeBankAccount.accountName, accountPassword: exchangeBankAccount.accountPassword, + allowHttp: true, }); await wireGatewayApiClient.adminAddIncoming({ diff --git a/packages/taler-harness/src/integrationtests/test-exchange-deposit.ts b/packages/taler-harness/src/integrationtests/test-exchange-deposit.ts index 18a3c172a..6c0d070d0 100644 --- a/packages/taler-harness/src/integrationtests/test-exchange-deposit.ts +++ b/packages/taler-harness/src/integrationtests/test-exchange-deposit.ts @@ -33,6 +33,7 @@ import { refreshCoin, SynchronousCryptoWorkerFactoryPlain, topupReserveWithDemobank, + Wallet, withdrawCoin, } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; @@ -46,7 +47,10 @@ export async function runExchangeDepositTest(t: GlobalTestState) { const { bank, exchange } = await createSimpleTestkudosEnvironment(t); - const http = createPlatformHttpLib(); + const http = createPlatformHttpLib({ + allowHttp: true, + enableThrottling: false, + }); const cryptiDisp = new CryptoDispatcher( new SynchronousCryptoWorkerFactoryPlain(), ); @@ -71,7 +75,9 @@ export async function runExchangeDepositTest(t: GlobalTestState) { await checkReserve(http, exchange.baseUrl, reserveKeyPair.pub); - const d1 = findDenomOrThrow(exchangeInfo, "TESTKUDOS:8"); + const d1 = findDenomOrThrow(exchangeInfo, "TESTKUDOS:8", { + denomselAllowLate: Wallet.defaultConfig.testing.denomselAllowLate, + }); const coin = await withdrawCoin({ http, diff --git a/packages/taler-harness/src/integrationtests/test-exchange-timetravel.ts b/packages/taler-harness/src/integrationtests/test-exchange-timetravel.ts index 20285cb6a..7f94628a6 100644 --- a/packages/taler-harness/src/integrationtests/test-exchange-timetravel.ts +++ b/packages/taler-harness/src/integrationtests/test-exchange-timetravel.ts @@ -24,7 +24,10 @@ import { Duration, durationFromSpec, } from "@gnu-taler/taler-util"; -import { createPlatformHttpLib, readSuccessResponseJsonOrThrow } from "@gnu-taler/taler-util/http"; +import { + createPlatformHttpLib, + readSuccessResponseJsonOrThrow, +} from "@gnu-taler/taler-util/http"; import { makeNoFeeCoinConfig } from "../harness/denomStructures.js"; import { BankService, @@ -65,7 +68,10 @@ async function applyTimeTravel( } } -const http = createPlatformHttpLib(); +const http = createPlatformHttpLib({ + allowHttp: true, + enableThrottling: false, +}); /** * Basic time travel test. diff --git a/packages/taler-harness/src/integrationtests/test-kyc.ts b/packages/taler-harness/src/integrationtests/test-kyc.ts index b7ea0ff77..b86c8dd5b 100644 --- a/packages/taler-harness/src/integrationtests/test-kyc.ts +++ b/packages/taler-harness/src/integrationtests/test-kyc.ts @@ -340,7 +340,10 @@ export async function runKycTest(t: GlobalTestState) { // We now simulate the user interacting with the KYC service, // which would usually done in the browser. - const httpLib = createPlatformHttpLib(); + const httpLib = createPlatformHttpLib({ + allowHttp: true, + enableThrottling: false, + }); const kycServerResp = await httpLib.get(kycNotif.kycUrl); const kycLoginResp = await kycServerResp.json(); console.log("kyc server resp:", j2s(kycLoginResp)); diff --git a/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts b/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts index 2fafe7584..975ba707b 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts @@ -39,7 +39,10 @@ import { withdrawViaBank, } from "../harness/helpers.js"; -const httpLib = createPlatformHttpLib(); +const httpLib = createPlatformHttpLib({ + allowHttp: true, + enableThrottling: false, +}); interface Context { merchant: MerchantService; diff --git a/packages/taler-harness/src/integrationtests/test-tipping.ts b/packages/taler-harness/src/integrationtests/test-tipping.ts index 69afad6fd..b124fbf0d 100644 --- a/packages/taler-harness/src/integrationtests/test-tipping.ts +++ b/packages/taler-harness/src/integrationtests/test-tipping.ts @@ -61,6 +61,7 @@ export async function runTippingTest(t: GlobalTestState) { wireGatewayApiBaseUrl: exchangeBankAccount.wireGatewayApiBaseUrl, accountName: exchangeBankAccount.accountName, accountPassword: exchangeBankAccount.accountPassword, + allowHttp: true, }); await wireGatewayApiClient.adminAddIncoming({ diff --git a/packages/taler-harness/src/integrationtests/test-wallet-dbless.ts b/packages/taler-harness/src/integrationtests/test-wallet-dbless.ts index 37be9dcf8..c384a6e74 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-dbless.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-dbless.ts @@ -33,6 +33,7 @@ import { refreshCoin, SynchronousCryptoWorkerFactoryPlain, topupReserveWithDemobank, + Wallet, withdrawCoin, } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; @@ -46,7 +47,10 @@ export async function runWalletDblessTest(t: GlobalTestState) { const { bank, exchange } = await createSimpleTestkudosEnvironment(t); - const http = createPlatformHttpLib(); + const http = createPlatformHttpLib({ + allowHttp: true, + enableThrottling: false, + }); const cryptiDisp = new CryptoDispatcher( new SynchronousCryptoWorkerFactoryPlain(), ); @@ -84,7 +88,9 @@ export async function runWalletDblessTest(t: GlobalTestState) { await checkReserve(http, exchange.baseUrl, reserveKeyPair.pub); - const d1 = findDenomOrThrow(exchangeInfo, "TESTKUDOS:8"); + const d1 = findDenomOrThrow(exchangeInfo, "TESTKUDOS:8", { + denomselAllowLate: Wallet.defaultConfig.testing.denomselAllowLate, + }); const coin = await withdrawCoin({ http, @@ -125,8 +131,12 @@ export async function runWalletDblessTest(t: GlobalTestState) { }); const refreshDenoms = [ - findDenomOrThrow(exchangeInfo, "TESTKUDOS:1"), - findDenomOrThrow(exchangeInfo, "TESTKUDOS:1"), + findDenomOrThrow(exchangeInfo, "TESTKUDOS:1", { + denomselAllowLate: Wallet.defaultConfig.testing.denomselAllowLate, + }), + findDenomOrThrow(exchangeInfo, "TESTKUDOS:1", { + denomselAllowLate: Wallet.defaultConfig.testing.denomselAllowLate, + }), ]; await refreshCoin({ diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-manual.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-manual.ts index 4a79d2c21..a356a5c1a 100644 --- a/packages/taler-harness/src/integrationtests/test-withdrawal-manual.ts +++ b/packages/taler-harness/src/integrationtests/test-withdrawal-manual.ts @@ -73,6 +73,7 @@ export async function runWithdrawalManualTest(t: GlobalTestState) { wireGatewayApiBaseUrl: exchangeBankAccount.wireGatewayApiBaseUrl, accountName: exchangeBankAccount.accountName, accountPassword: exchangeBankAccount.accountPassword, + allowHttp: true, }); await wireGatewayApiClient.adminAddIncoming({ diff --git a/packages/taler-harness/src/integrationtests/testrunner.ts b/packages/taler-harness/src/integrationtests/testrunner.ts index f845f4e99..c76ce1b18 100644 --- a/packages/taler-harness/src/integrationtests/testrunner.ts +++ b/packages/taler-harness/src/integrationtests/testrunner.ts @@ -14,7 +14,7 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { CancellationToken, minimatch } from "@gnu-taler/taler-util"; +import { CancellationToken, Logger, minimatch } from "@gnu-taler/taler-util"; import * as child_process from "child_process"; import * as fs from "fs"; import * as os from "os"; @@ -105,6 +105,7 @@ import { runExchangeDepositTest } from "./test-exchange-deposit.js"; /** * Test runner. */ +const logger = new Logger("testrunner.ts"); /** * Spec for one test. @@ -199,6 +200,8 @@ export interface TestRunSpec { includePattern?: string; suiteSpec?: string; dryRun?: boolean; + failFast?: boolean; + waitOnFail?: boolean; includeExperimental: boolean; noTimeout: boolean; verbosity: number; @@ -357,7 +360,7 @@ export async function runTests(spec: TestRunSpec) { if (token.isCancelled) { return; } - console.log(`process exited code=${code} signal=${signal}`); + logger.info(`process exited code=${code} signal=${signal}`); if (signal) { reject(new Error(`test worker exited with signal ${signal}`)); } else if (code != 0) { @@ -385,6 +388,10 @@ export async function runTests(spec: TestRunSpec) { try { result = await token.racePromise(resultPromise); + if (result.status === "fail" && spec.failFast) { + logger.error("test failed and failing fast, exit!"); + throw Error("exit on fail fast"); + } } catch (e: any) { console.error(`test ${testName} timed out`); if (token.isCancelled) { @@ -469,10 +476,9 @@ if (runTestInstrStr && process.argv.includes("__TWCLI_TESTWORKER")) { const { testRootDir, testName } = JSON.parse( runTestInstrStr, ) as RunTestChildInstruction; - console.log(`running test ${testName} in worker process`); process.on("disconnect", () => { - console.log("got disconnect from parent"); + logger.trace("got disconnect from parent"); process.exit(3); }); @@ -486,35 +492,36 @@ if (runTestInstrStr && process.argv.includes("__TWCLI_TESTWORKER")) { } if (!process.send) { - console.error("can't communicate with parent"); + logger.error("can't communicate with parent"); process.exit(2); } if (!testMain) { - console.log(`test ${testName} not found`); + logger.info(`test ${testName} not found`); process.exit(2); } const testDir = path.join(testRootDir, testName); - console.log(`running test ${testName}`); + logger.info(`running test ${testName}`); const gc = new GlobalTestState({ testDir, }); const testResult = await runTestWithState(gc, testMain, testName); + logger.info(`done test ${testName}: ${testResult.status}`); process.send(testResult); }; runTest() .then(() => { - console.log(`test ${testName} finished in worker`); + logger.trace(`test ${testName} finished in worker`); if (shouldLingerInTest()) { - console.log("lingering ..."); + logger.trace("lingering ..."); return; } process.exit(0); }) .catch((e) => { - console.log(e); + logger.error(e); process.exit(1); }); } |