From 9a1a3b350d4147243dbe2ecfcdcb846c0f3c6dcb Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 6 Sep 2023 11:23:33 +0200 Subject: harness: get rid of deprecated merchant API client --- .../src/integrationtests/test-claim-loop.ts | 27 +++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'packages/taler-harness/src/integrationtests/test-claim-loop.ts') diff --git a/packages/taler-harness/src/integrationtests/test-claim-loop.ts b/packages/taler-harness/src/integrationtests/test-claim-loop.ts index 32706c28b..52841dbab 100644 --- a/packages/taler-harness/src/integrationtests/test-claim-loop.ts +++ b/packages/taler-harness/src/integrationtests/test-claim-loop.ts @@ -19,7 +19,10 @@ */ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { URL } from "url"; -import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js"; +import { + GlobalTestState, + MerchantApiClient, +} from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, withdrawViaBankV2, @@ -44,8 +47,10 @@ export async function runClaimLoopTest(t: GlobalTestState) { amount: "TESTKUDOS:20", }); + const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); + // Set up order. - const orderResp = await MerchantPrivateApi.createOrder(merchant, "default", { + const orderResp = await merchantClient.createOrder({ order: { summary: "Buy me!", amount: "TESTKUDOS:5", @@ -54,12 +59,9 @@ export async function runClaimLoopTest(t: GlobalTestState) { }); // Query private order status before claiming it. - let orderStatusBefore = await MerchantPrivateApi.queryPrivateOrderStatus( - merchant, - { - orderId: orderResp.order_id, - }, - ); + let orderStatusBefore = await merchantClient.queryPrivateOrderStatus({ + orderId: orderResp.order_id, + }); t.assertTrue(orderStatusBefore.order_status === "unpaid"); let statusUrlBefore = new URL(orderStatusBefore.order_status_url); @@ -71,12 +73,9 @@ export async function runClaimLoopTest(t: GlobalTestState) { }); // Query private order status after claiming it. - let orderStatusAfter = await MerchantPrivateApi.queryPrivateOrderStatus( - merchant, - { - orderId: orderResp.order_id, - }, - ); + let orderStatusAfter = await merchantClient.queryPrivateOrderStatus({ + orderId: orderResp.order_id, + }); t.assertTrue(orderStatusAfter.order_status === "claimed"); await t.shutdown(); -- cgit v1.2.3 From 324d9f871c356f48f64c170a793024139ae2694d Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 6 Sep 2023 11:44:07 +0200 Subject: move merchant API client to taler-util --- packages/taler-harness/src/harness/harness.ts | 299 +-------------------- packages/taler-harness/src/harness/helpers.ts | 2 +- packages/taler-harness/src/index.ts | 7 +- .../test-age-restrictions-merchant.ts | 12 +- .../src/integrationtests/test-claim-loop.ts | 6 +- .../src/integrationtests/test-denom-unoffered.ts | 9 +- .../taler-harness/src/integrationtests/test-kyc.ts | 4 +- .../test-merchant-exchange-confusion.ts | 2 +- .../test-merchant-instances-delete.ts | 10 +- .../test-merchant-instances-urls.ts | 6 +- .../integrationtests/test-merchant-instances.ts | 4 +- .../integrationtests/test-merchant-longpolling.ts | 7 +- .../integrationtests/test-merchant-refund-api.ts | 26 +- .../test-merchant-spec-public-orders.ts | 2 +- .../src/integrationtests/test-pay-paid.ts | 19 +- .../src/integrationtests/test-payment-abort.ts | 21 +- .../src/integrationtests/test-payment-claim.ts | 8 +- .../src/integrationtests/test-payment-expired.ts | 15 +- .../src/integrationtests/test-payment-fault.ts | 29 +- .../integrationtests/test-payment-idempotency.ts | 4 +- .../src/integrationtests/test-payment-multiple.ts | 10 +- .../src/integrationtests/test-payment-share.ts | 3 +- .../src/integrationtests/test-payment-template.ts | 3 +- .../src/integrationtests/test-payment-transient.ts | 7 +- .../src/integrationtests/test-paywall-flow.ts | 9 +- .../src/integrationtests/test-refund-auto.ts | 8 +- .../src/integrationtests/test-refund-gone.ts | 13 +- .../integrationtests/test-refund-incremental.ts | 7 +- .../src/integrationtests/test-refund.ts | 3 +- .../test-timetravel-autorefresh.ts | 4 +- .../src/integrationtests/test-tipping.ts | 11 +- .../test-wallet-backup-doublespend.ts | 12 +- .../src/integrationtests/test-wallet-balance.ts | 8 +- packages/taler-util/src/index.ts | 2 + packages/taler-util/src/merchant-api-types.ts | 20 +- 35 files changed, 141 insertions(+), 471 deletions(-) (limited to 'packages/taler-harness/src/integrationtests/test-claim-loop.ts') diff --git a/packages/taler-harness/src/harness/harness.ts b/packages/taler-harness/src/harness/harness.ts index a16cef7ba..df3c9b215 100644 --- a/packages/taler-harness/src/harness/harness.ts +++ b/packages/taler-harness/src/harness/harness.ts @@ -57,6 +57,8 @@ import { WalletNotification, codecForAny, AccountAddDetails, + MerchantInstanceConfig, + PartialMerchantInstanceConfig, } from "@gnu-taler/taler-util"; import { createPlatformHttpLib, @@ -1339,23 +1341,12 @@ export interface MerchantConfig { overrideTestDir?: string; } -export interface PrivateOrderStatusQuery { - instance?: string; - orderId: string; - sessionId?: string; -} - export interface MerchantServiceInterface { makeInstanceBaseUrl(instanceName?: string): string; readonly port: number; readonly name: string; } -export interface DeleteTippingReserveArgs { - reservePub: string; - purge?: boolean; -} - /** * Default HTTP client handle for the integration test harness. */ @@ -1364,232 +1355,6 @@ export const harnessHttpLib = createPlatformHttpLib({ enableThrottling: false, }); -/** - * FIXME: Move this out of the harness. - */ -export class MerchantApiClient { - /** - * Base URL for the particular instance that this merchant API client - * is for. - */ - private baseUrl: string; - - readonly auth: MerchantAuthConfiguration; - - constructor(baseUrl: string, auth?: MerchantAuthConfiguration) { - this.baseUrl = baseUrl; - - this.auth = auth ?? { - method: "external", - }; - } - - httpClient = createPlatformHttpLib({ - allowHttp: true, - enableThrottling: false, - }); - - async changeAuth(auth: MerchantAuthConfiguration): Promise { - const url = new URL("private/auth", this.baseUrl); - const res = await this.httpClient.fetch(url.href, { - method: "POST", - body: auth, - headers: this.makeAuthHeader(), - }); - await expectSuccessResponseOrThrow(res); - } - - async deleteTippingReserve(req: DeleteTippingReserveArgs): Promise { - const url = new URL(`private/reserves/${req.reservePub}`, this.baseUrl); - if (req.purge) { - url.searchParams.set("purge", "YES"); - } - const resp = await this.httpClient.fetch(url.href, { - method: "DELETE", - headers: this.makeAuthHeader(), - }); - logger.info(`delete status: ${resp.status}`); - return; - } - - async createTippingReserve( - req: CreateMerchantTippingReserveRequest, - ): Promise { - const url = new URL("private/reserves", this.baseUrl); - const resp = await this.httpClient.fetch(url.href, { - method: "POST", - body: req, - headers: this.makeAuthHeader(), - }); - const respData = readSuccessResponseJsonOrThrow( - resp, - codecForMerchantReserveCreateConfirmation(), - ); - return respData; - } - - async getPrivateInstanceInfo(): Promise { - const url = new URL("private", this.baseUrl); - const resp = await this.httpClient.fetch(url.href, { - method: "GET", - headers: this.makeAuthHeader(), - }); - return await resp.json(); - } - - async getPrivateTipReserves(): Promise { - const url = new URL("private/reserves", this.baseUrl); - const resp = await this.httpClient.fetch(url.href, { - method: "GET", - headers: this.makeAuthHeader(), - }); - // FIXME: Validate! - return await resp.json(); - } - - async deleteInstance(instanceId: string) { - const url = new URL(`management/instances/${instanceId}`, this.baseUrl); - const resp = await this.httpClient.fetch(url.href, { - method: "DELETE", - headers: this.makeAuthHeader(), - }); - await expectSuccessResponseOrThrow(resp); - } - - async createInstance(req: MerchantInstanceConfig): Promise { - const url = new URL("management/instances", this.baseUrl); - await this.httpClient.fetch(url.href, { - method: "POST", - body: req, - headers: this.makeAuthHeader(), - }); - } - - async getInstances(): Promise { - const url = new URL("management/instances", this.baseUrl); - const resp = await this.httpClient.fetch(url.href, { - headers: this.makeAuthHeader(), - }); - return resp.json(); - } - - async getInstanceFullDetails(instanceId: string): Promise { - const url = new URL(`management/instances/${instanceId}`, this.baseUrl); - try { - const resp = await this.httpClient.fetch(url.href, { - headers: this.makeAuthHeader(), - }); - return resp.json(); - } catch (e) { - throw e; - } - } - - async createOrder( - req: MerchantPostOrderRequest, - ): Promise { - let url = new URL("private/orders", this.baseUrl); - const resp = await harnessHttpLib.fetch(url.href, { - method: "POST", - body: req, - headers: this.makeAuthHeader(), - }); - return readSuccessResponseJsonOrThrow( - resp, - codecForMerchantPostOrderResponse(), - ); - } - - async queryPrivateOrderStatus( - query: PrivateOrderStatusQuery, - ): Promise { - const reqUrl = new URL(`private/orders/${query.orderId}`, this.baseUrl); - if (query.sessionId) { - reqUrl.searchParams.set("session_id", query.sessionId); - } - const resp = await harnessHttpLib.fetch(reqUrl.href, { - headers: this.makeAuthHeader(), - }); - return readSuccessResponseJsonOrThrow( - resp, - codecForMerchantOrderPrivateStatusResponse(), - ); - } - - async giveTip(req: RewardCreateRequest): Promise { - const reqUrl = new URL(`private/tips`, this.baseUrl); - const resp = await harnessHttpLib.fetch(reqUrl.href, { - method: "POST", - body: req, - }); - // FIXME: validate - return resp.json(); - } - - async queryTippingReserves(): Promise { - const reqUrl = new URL(`private/reserves`, this.baseUrl); - const resp = await harnessHttpLib.fetch(reqUrl.href, { - headers: this.makeAuthHeader(), - }); - // FIXME: validate - return resp.json(); - } - - async giveRefund(r: { - instance: string; - orderId: string; - amount: string; - justification: string; - }): Promise<{ talerRefundUri: string }> { - const reqUrl = new URL(`private/orders/${r.orderId}/refund`, this.baseUrl); - const resp = await harnessHttpLib.fetch(reqUrl.href, { - method: "POST", - body: { - refund: r.amount, - reason: r.justification, - }, - }); - const respBody = await resp.json(); - return { - talerRefundUri: respBody.taler_refund_uri, - }; - } - - async createTemplate(req: MerchantTemplateAddDetails) { - let url = new URL("private/templates", this.baseUrl); - const resp = await harnessHttpLib.fetch(url.href, { - method: "POST", - body: req, - headers: this.makeAuthHeader(), - }); - if (resp.status !== 204) { - throw Error("failed to create template"); - } - } - - private makeAuthHeader(): Record { - switch (this.auth.method) { - case "external": - return {}; - case "token": - return { - Authorization: `Bearer ${this.auth.token}`, - }; - } - } -} - -export interface CreateMerchantTippingReserveRequest { - // Amount that the merchant promises to put into the reserve - initial_balance: AmountString; - - // Exchange the merchant intends to use for tipping - exchange_url: string; - - // Desired wire method, for example "iban" or "x-taler-bank" - wire_method: string; -} - export class MerchantService implements MerchantServiceInterface { static fromExistingConfig( gc: GlobalTestState, @@ -1814,66 +1579,6 @@ export class MerchantService implements MerchantServiceInterface { } } -export interface MerchantAuthConfiguration { - method: "external" | "token"; - token?: string; -} - -// FIXME: Why do we need this? Describe / fix! -export interface PartialMerchantInstanceConfig { - auth?: MerchantAuthConfiguration; - id: string; - name: string; - paytoUris: string[]; - address?: unknown; - jurisdiction?: unknown; - defaultWireTransferDelay?: TalerProtocolDuration; - defaultPayDelay?: TalerProtocolDuration; -} - -// FIXME: Move all these types into merchant-api-types.ts! - -type FacadeCredentials = NoFacadeCredentials | BasicAuthFacadeCredentials; -interface NoFacadeCredentials { - type: "none"; -} -interface BasicAuthFacadeCredentials { - type: "basic"; - - // Username to use to authenticate - username: string; - - // Password to use to authenticate - password: string; -} - -interface MerchantBankAccount { - // The payto:// URI where the wallet will send coins. - payto_uri: string; - - // Optional base URL for a facade where the - // merchant backend can see incoming wire - // transfers to reconcile its accounting - // with that of the exchange. Used by - // taler-merchant-wirewatch. - credit_facade_url?: string; - - // Credentials for accessing the credit facade. - credit_facade_credentials?: FacadeCredentials; -} - -export interface MerchantInstanceConfig { - accounts: MerchantBankAccount[]; - auth: MerchantAuthConfiguration; - id: string; - name: string; - address: unknown; - jurisdiction: unknown; - use_stefan: boolean; - default_wire_transfer_delay: TalerProtocolDuration; - default_pay_delay: TalerProtocolDuration; -} - type TestStatus = "pass" | "fail" | "skip"; export interface TestRunResult { diff --git a/packages/taler-harness/src/harness/helpers.ts b/packages/taler-harness/src/harness/helpers.ts index 485e1baba..7b2f7d8f1 100644 --- a/packages/taler-harness/src/harness/helpers.ts +++ b/packages/taler-harness/src/harness/helpers.ts @@ -33,6 +33,7 @@ import { WalletNotification, TransactionMajorState, Logger, + MerchantApiClient, } from "@gnu-taler/taler-util"; import { BankAccessApi, @@ -53,7 +54,6 @@ import { FakebankService, getPayto, GlobalTestState, - MerchantApiClient, MerchantService, MerchantServiceInterface, setupDb, diff --git a/packages/taler-harness/src/index.ts b/packages/taler-harness/src/index.ts index 3b50acf75..ed2e545f7 100644 --- a/packages/taler-harness/src/index.ts +++ b/packages/taler-harness/src/index.ts @@ -24,6 +24,7 @@ import { decodeCrock, j2s, Logger, + MerchantApiClient, rsaBlind, setGlobalLogLevelFromString, } from "@gnu-taler/taler-util"; @@ -45,11 +46,7 @@ import { runBench2 } from "./bench2.js"; import { runBench3 } from "./bench3.js"; import { runEnvFull } from "./env-full.js"; import { runEnv1 } from "./env1.js"; -import { - GlobalTestState, - MerchantApiClient, - runTestWithState, -} from "./harness/harness.js"; +import { GlobalTestState, runTestWithState } from "./harness/harness.js"; import { getTestInfo, runTests } from "./integrationtests/testrunner.js"; import { lintExchangeDeployment } from "./lint.js"; 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 45a035cc4..4e096e0ea 100644 --- a/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts +++ b/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts @@ -1,6 +1,6 @@ /* This file is part of GNU Taler - (C) 2022 Taler Systems S.A. + (C) 2022-2023 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 @@ -23,17 +23,14 @@ import { WireGatewayApiClient, } from "@gnu-taler/taler-wallet-core"; import { defaultCoinConfig } from "../harness/denomStructures.js"; -import { - getWireMethodForTest, - GlobalTestState, - MerchantApiClient, -} from "../harness/harness.js"; +import { getWireMethodForTest, GlobalTestState } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, createWalletDaemonWithClient, makeTestPaymentV2, withdrawViaBankV2, } from "../harness/helpers.js"; +import { MerchantApiClient } from "@gnu-taler/taler-util"; /** * Run test for basic, bank-integrated withdrawal and payment. @@ -57,9 +54,6 @@ export async function runAgeRestrictionsMerchantTest(t: GlobalTestState) { const merchantClient = new MerchantApiClient( merchant.makeInstanceBaseUrl("default"), - { - method: "external", - }, ); const { walletClient: walletClientTwo } = await createWalletDaemonWithClient( diff --git a/packages/taler-harness/src/integrationtests/test-claim-loop.ts b/packages/taler-harness/src/integrationtests/test-claim-loop.ts index 52841dbab..652df72ec 100644 --- a/packages/taler-harness/src/integrationtests/test-claim-loop.ts +++ b/packages/taler-harness/src/integrationtests/test-claim-loop.ts @@ -19,14 +19,12 @@ */ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { URL } from "url"; -import { - GlobalTestState, - MerchantApiClient, -} from "../harness/harness.js"; +import { GlobalTestState } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, withdrawViaBankV2, } from "../harness/helpers.js"; +import { MerchantApiClient } from "@gnu-taler/taler-util"; /** * Run test for the merchant's order lifecycle. diff --git a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts index a9282f394..afd0c901b 100644 --- a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts +++ b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts @@ -17,12 +17,13 @@ /** * Imports. */ -import { PreparePayResultType, TalerErrorCode } from "@gnu-taler/taler-util"; -import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { - GlobalTestState, MerchantApiClient, -} from "../harness/harness.js"; + PreparePayResultType, + TalerErrorCode, +} from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import { GlobalTestState } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, withdrawViaBankV2, diff --git a/packages/taler-harness/src/integrationtests/test-kyc.ts b/packages/taler-harness/src/integrationtests/test-kyc.ts index 34ad46e03..22c8ce03c 100644 --- a/packages/taler-harness/src/integrationtests/test-kyc.ts +++ b/packages/taler-harness/src/integrationtests/test-kyc.ts @@ -26,11 +26,13 @@ import { TransactionMinorState, TransactionType, } from "@gnu-taler/taler-util"; +import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; import { BankAccessApi, BankApi, WalletApiOperation, } from "@gnu-taler/taler-wallet-core"; +import * as http from "node:http"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { BankService, @@ -43,8 +45,6 @@ import { WalletService, } from "../harness/harness.js"; import { EnvOptions, SimpleTestEnvironmentNg } from "../harness/helpers.js"; -import * as http from "node:http"; -import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; const logger = new Logger("test-kyc.ts"); diff --git a/packages/taler-harness/src/integrationtests/test-merchant-exchange-confusion.ts b/packages/taler-harness/src/integrationtests/test-merchant-exchange-confusion.ts index 3c71e0f7e..e8f5a435a 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-exchange-confusion.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-exchange-confusion.ts @@ -20,6 +20,7 @@ import { codecForMerchantOrderStatusUnpaid, ConfirmPayResultType, + MerchantApiClient, PreparePayResultType, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; @@ -35,7 +36,6 @@ import { getPayto, GlobalTestState, harnessHttpLib, - MerchantApiClient, MerchantService, setupDb, } from "../harness/harness.js"; diff --git a/packages/taler-harness/src/integrationtests/test-merchant-instances-delete.ts b/packages/taler-harness/src/integrationtests/test-merchant-instances-delete.ts index 1c99dda76..ff567d33d 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-instances-delete.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-instances-delete.ts @@ -17,17 +17,15 @@ /** * Imports. */ -import { TalerError, URL } from "@gnu-taler/taler-util"; +import { MerchantApiClient, TalerError, URL } from "@gnu-taler/taler-util"; import { ExchangeService, GlobalTestState, - MerchantApiClient, MerchantService, - setupDb, getPayto, harnessHttpLib, + setupDb, } from "../harness/harness.js"; -import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; /** * Test instance deletion and authentication for it @@ -69,7 +67,9 @@ export async function runMerchantInstancesDeleteTest(t: GlobalTestState) { // Instances should initially be empty { - const r = await harnessHttpLib.fetch(new URL("management/instances", baseUrl).href); + const r = await harnessHttpLib.fetch( + new URL("management/instances", baseUrl).href, + ); const data = await r.json(); t.assertDeepEqual(data.instances, []); } diff --git a/packages/taler-harness/src/integrationtests/test-merchant-instances-urls.ts b/packages/taler-harness/src/integrationtests/test-merchant-instances-urls.ts index 18a09c76b..071288b0f 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-instances-urls.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-instances-urls.ts @@ -17,17 +17,15 @@ /** * Imports. */ -import { Duration } from "@gnu-taler/taler-util"; +import { Duration, MerchantApiClient } from "@gnu-taler/taler-util"; import { ExchangeService, GlobalTestState, - MerchantApiClient, MerchantService, - setupDb, getPayto, harnessHttpLib, + setupDb, } from "../harness/harness.js"; -import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; /** * Do basic checks on instance management and authentication. diff --git a/packages/taler-harness/src/integrationtests/test-merchant-instances.ts b/packages/taler-harness/src/integrationtests/test-merchant-instances.ts index 54205e9f2..fd7a8ca3a 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-instances.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-instances.ts @@ -17,17 +17,15 @@ /** * Imports. */ -import { URL } from "@gnu-taler/taler-util"; +import { MerchantApiClient, URL } from "@gnu-taler/taler-util"; import { ExchangeService, GlobalTestState, - MerchantApiClient, MerchantService, setupDb, getPayto, harnessHttpLib, } from "../harness/harness.js"; -import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; /** * Do basic checks on instance management and authentication. diff --git a/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts b/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts index d7ffa28d5..bd63a8445 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts @@ -19,16 +19,13 @@ */ import { ConfirmPayResultType, + MerchantApiClient, PreparePayResultType, URL, codecForMerchantOrderStatusUnpaid, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { - GlobalTestState, - MerchantApiClient, - harnessHttpLib, -} from "../harness/harness.js"; +import { GlobalTestState, harnessHttpLib } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, withdrawViaBankV2, diff --git a/packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts b/packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts index ebca4f769..369f261dd 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts @@ -18,27 +18,27 @@ * Imports. */ import { + Duration, + MerchantApiClient, + PreparePayResultType, + URL, + durationFromSpec, +} from "@gnu-taler/taler-util"; +import { + BankServiceHandle, + WalletApiOperation, +} from "@gnu-taler/taler-wallet-core"; +import { + ExchangeServiceInterface, GlobalTestState, MerchantServiceInterface, - ExchangeServiceInterface, - harnessHttpLib, WalletClient, - MerchantApiClient, + harnessHttpLib, } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, withdrawViaBankV2, } from "../harness/helpers.js"; -import { - URL, - durationFromSpec, - PreparePayResultType, - Duration, -} from "@gnu-taler/taler-util"; -import { - WalletApiOperation, - BankServiceHandle, -} from "@gnu-taler/taler-wallet-core"; async function testRefundApiWithFulfillmentUrl( t: GlobalTestState, 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 599a3fc16..afae8a899 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 @@ -19,6 +19,7 @@ */ import { ConfirmPayResultType, + MerchantApiClient, PreparePayResultType, URL, encodeCrock, @@ -29,7 +30,6 @@ import { BankService, ExchangeService, GlobalTestState, - MerchantApiClient, MerchantService, harnessHttpLib, } from "../harness/harness.js"; diff --git a/packages/taler-harness/src/integrationtests/test-pay-paid.ts b/packages/taler-harness/src/integrationtests/test-pay-paid.ts index 4fe13b3ae..3d93f6e29 100644 --- a/packages/taler-harness/src/integrationtests/test-pay-paid.ts +++ b/packages/taler-harness/src/integrationtests/test-pay-paid.ts @@ -18,22 +18,19 @@ * Imports. */ import { - GlobalTestState, + ConfirmPayResultType, MerchantApiClient, - harnessHttpLib, -} from "../harness/harness.js"; -import { - createFaultInjectedMerchantTestkudosEnvironment, - withdrawViaBankV2, -} from "../harness/helpers.js"; -import { PreparePayResultType, - codecForMerchantOrderStatusUnpaid, - ConfirmPayResultType, URL, + codecForMerchantOrderStatusUnpaid, } from "@gnu-taler/taler-util"; -import { FaultInjectionRequestContext } from "../harness/faultInjection.js"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import { FaultInjectionRequestContext } from "../harness/faultInjection.js"; +import { GlobalTestState, harnessHttpLib } from "../harness/harness.js"; +import { + createFaultInjectedMerchantTestkudosEnvironment, + withdrawViaBankV2, +} from "../harness/helpers.js"; /** * Run test for the wallets repurchase detection mechanism diff --git a/packages/taler-harness/src/integrationtests/test-payment-abort.ts b/packages/taler-harness/src/integrationtests/test-payment-abort.ts index 22e087161..3164bbaf3 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-abort.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-abort.ts @@ -18,25 +18,22 @@ * Imports. */ import { - GlobalTestState, - MerchantApiClient, - harnessHttpLib, -} from "../harness/harness.js"; -import { - createFaultInjectedMerchantTestkudosEnvironment, - withdrawViaBankV2, -} from "../harness/helpers.js"; -import { FaultInjectionRequestContext } from "../harness/faultInjection.js"; -import { - codecForMerchantOrderStatusUnpaid, ConfirmPayResultType, - j2s, + MerchantApiClient, PreparePayResultType, TalerErrorCode, TalerErrorDetail, URL, + codecForMerchantOrderStatusUnpaid, + j2s, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import { FaultInjectionRequestContext } from "../harness/faultInjection.js"; +import { GlobalTestState, harnessHttpLib } from "../harness/harness.js"; +import { + createFaultInjectedMerchantTestkudosEnvironment, + withdrawViaBankV2, +} from "../harness/helpers.js"; export async function runPaymentAbortTest(t: GlobalTestState) { // Set up test environment diff --git a/packages/taler-harness/src/integrationtests/test-payment-claim.ts b/packages/taler-harness/src/integrationtests/test-payment-claim.ts index df86b3cbf..b5ed89ec3 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-claim.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-claim.ts @@ -17,9 +17,13 @@ /** * Imports. */ -import { PreparePayResultType, TalerErrorCode } from "@gnu-taler/taler-util"; +import { + MerchantApiClient, + PreparePayResultType, + TalerErrorCode, +} from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { GlobalTestState, MerchantApiClient, WalletCli } from "../harness/harness.js"; +import { GlobalTestState, WalletCli } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, withdrawViaBankV2, diff --git a/packages/taler-harness/src/integrationtests/test-payment-expired.ts b/packages/taler-harness/src/integrationtests/test-payment-expired.ts index 4817efba5..176fc74f7 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-expired.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-expired.ts @@ -17,21 +17,22 @@ /** * Imports. */ -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, + MerchantApiClient, MerchantContractTerms, PreparePayResultType, j2s, } from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import { GlobalTestState } from "../harness/harness.js"; +import { + applyTimeTravelV2, + createSimpleTestkudosEnvironmentV2, + withdrawViaBankV2, +} from "../harness/helpers.js"; /** * Run a test for the following scenario: diff --git a/packages/taler-harness/src/integrationtests/test-payment-fault.ts b/packages/taler-harness/src/integrationtests/test-payment-fault.ts index 5d0fe6e13..70fa587e7 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-fault.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-fault.ts @@ -21,28 +21,27 @@ /** * Imports. */ +import { CoreApiResponse, MerchantApiClient } from "@gnu-taler/taler-util"; import { - GlobalTestState, - MerchantService, - ExchangeService, - setupDb, - BankService, - WalletCli, - getPayto, - MerchantApiClient, -} from "../harness/harness.js"; + BankAccessApi, + BankApi, + WalletApiOperation, +} from "@gnu-taler/taler-wallet-core"; +import { defaultCoinConfig } from "../harness/denomStructures.js"; import { FaultInjectedExchangeService, FaultInjectionRequestContext, FaultInjectionResponseContext, } from "../harness/faultInjection.js"; -import { CoreApiResponse } from "@gnu-taler/taler-util"; -import { defaultCoinConfig } from "../harness/denomStructures.js"; import { - WalletApiOperation, - BankApi, - BankAccessApi, -} from "@gnu-taler/taler-wallet-core"; + BankService, + ExchangeService, + GlobalTestState, + MerchantService, + WalletCli, + getPayto, + setupDb, +} from "../harness/harness.js"; /** * Run test for basic, bank-integrated withdrawal. diff --git a/packages/taler-harness/src/integrationtests/test-payment-idempotency.ts b/packages/taler-harness/src/integrationtests/test-payment-idempotency.ts index e06ef1322..65fd3a562 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-idempotency.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-idempotency.ts @@ -17,9 +17,9 @@ /** * Imports. */ -import { PreparePayResultType } from "@gnu-taler/taler-util"; +import { MerchantApiClient, PreparePayResultType } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { GlobalTestState, MerchantApiClient } from "../harness/harness.js"; +import { GlobalTestState } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, withdrawViaBankV2, diff --git a/packages/taler-harness/src/integrationtests/test-payment-multiple.ts b/packages/taler-harness/src/integrationtests/test-payment-multiple.ts index b22bba43f..23972ed63 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-multiple.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-multiple.ts @@ -17,17 +17,17 @@ /** * Imports. */ +import { MerchantApiClient } from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import { coin_ct10, coin_u1 } from "../harness/denomStructures.js"; import { - GlobalTestState, - setupDb, BankService, ExchangeService, + GlobalTestState, MerchantService, getPayto, - MerchantApiClient, + setupDb, } from "../harness/harness.js"; -import { coin_ct10, coin_u1 } from "../harness/denomStructures.js"; -import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { createWalletDaemonWithClient, withdrawViaBankV2, diff --git a/packages/taler-harness/src/integrationtests/test-payment-share.ts b/packages/taler-harness/src/integrationtests/test-payment-share.ts index c12140d06..c4a82c917 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-share.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-share.ts @@ -19,10 +19,11 @@ */ import { ConfirmPayResultType, + MerchantApiClient, PreparePayResultType, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { GlobalTestState, MerchantApiClient } from "../harness/harness.js"; +import { GlobalTestState } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, createWalletDaemonWithClient, diff --git a/packages/taler-harness/src/integrationtests/test-payment-template.ts b/packages/taler-harness/src/integrationtests/test-payment-template.ts index 2058991d0..e77236a9a 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-template.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-template.ts @@ -20,10 +20,11 @@ import { ConfirmPayResultType, Duration, + MerchantApiClient, PreparePayResultType, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { GlobalTestState, MerchantApiClient } from "../harness/harness.js"; +import { GlobalTestState } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, withdrawViaBankV2, diff --git a/packages/taler-harness/src/integrationtests/test-payment-transient.ts b/packages/taler-harness/src/integrationtests/test-payment-transient.ts index 3bc59aa8f..46e57735f 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-transient.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-transient.ts @@ -19,6 +19,7 @@ */ import { ConfirmPayResultType, + MerchantApiClient, PreparePayResultType, TalerErrorCode, TalerErrorDetail, @@ -27,11 +28,7 @@ import { } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { FaultInjectionResponseContext } from "../harness/faultInjection.js"; -import { - GlobalTestState, - MerchantApiClient, - harnessHttpLib, -} from "../harness/harness.js"; +import { GlobalTestState, harnessHttpLib } from "../harness/harness.js"; import { createFaultInjectedMerchantTestkudosEnvironment, withdrawViaBankV2, diff --git a/packages/taler-harness/src/integrationtests/test-paywall-flow.ts b/packages/taler-harness/src/integrationtests/test-paywall-flow.ts index fd13f37d6..247ec9cad 100644 --- a/packages/taler-harness/src/integrationtests/test-paywall-flow.ts +++ b/packages/taler-harness/src/integrationtests/test-paywall-flow.ts @@ -18,17 +18,14 @@ * Imports. */ import { - GlobalTestState, + ConfirmPayResultType, MerchantApiClient, - harnessHttpLib, -} from "../harness/harness.js"; -import { PreparePayResultType, - codecForMerchantOrderStatusUnpaid, - ConfirmPayResultType, URL, + codecForMerchantOrderStatusUnpaid, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import { GlobalTestState, harnessHttpLib } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, withdrawViaBankV2, diff --git a/packages/taler-harness/src/integrationtests/test-refund-auto.ts b/packages/taler-harness/src/integrationtests/test-refund-auto.ts index 9e1f31af2..e8bfecefa 100644 --- a/packages/taler-harness/src/integrationtests/test-refund-auto.ts +++ b/packages/taler-harness/src/integrationtests/test-refund-auto.ts @@ -17,9 +17,13 @@ /** * Imports. */ -import { Duration, durationFromSpec } from "@gnu-taler/taler-util"; +import { + Duration, + MerchantApiClient, + durationFromSpec, +} from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { GlobalTestState, MerchantApiClient } from "../harness/harness.js"; +import { GlobalTestState } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, withdrawViaBankV2, diff --git a/packages/taler-harness/src/integrationtests/test-refund-gone.ts b/packages/taler-harness/src/integrationtests/test-refund-gone.ts index 954262826..9ba078a6d 100644 --- a/packages/taler-harness/src/integrationtests/test-refund-gone.ts +++ b/packages/taler-harness/src/integrationtests/test-refund-gone.ts @@ -17,18 +17,19 @@ /** * Imports. */ -import { GlobalTestState, MerchantApiClient } from "../harness/harness.js"; -import { - applyTimeTravelV2, - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, -} from "../harness/helpers.js"; import { AbsoluteTime, Duration, + MerchantApiClient, durationFromSpec, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import { GlobalTestState } from "../harness/harness.js"; +import { + applyTimeTravelV2, + createSimpleTestkudosEnvironmentV2, + withdrawViaBankV2, +} from "../harness/helpers.js"; /** * Run test for basic, bank-integrated withdrawal. diff --git a/packages/taler-harness/src/integrationtests/test-refund-incremental.ts b/packages/taler-harness/src/integrationtests/test-refund-incremental.ts index 7c895ad2b..e7e041ce6 100644 --- a/packages/taler-harness/src/integrationtests/test-refund-incremental.ts +++ b/packages/taler-harness/src/integrationtests/test-refund-incremental.ts @@ -20,15 +20,12 @@ import { Amounts, Duration, + MerchantApiClient, TransactionType, durationFromSpec, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { - GlobalTestState, - MerchantApiClient, - delayMs, -} from "../harness/harness.js"; +import { GlobalTestState, delayMs } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, withdrawViaBankV2, diff --git a/packages/taler-harness/src/integrationtests/test-refund.ts b/packages/taler-harness/src/integrationtests/test-refund.ts index 3dc2748fe..aeeb91f38 100644 --- a/packages/taler-harness/src/integrationtests/test-refund.ts +++ b/packages/taler-harness/src/integrationtests/test-refund.ts @@ -20,11 +20,12 @@ import { Duration, durationFromSpec, + MerchantApiClient, NotificationType, TransactionMajorState, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { GlobalTestState, MerchantApiClient } from "../harness/harness.js"; +import { GlobalTestState } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, withdrawViaBankV2, diff --git a/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts b/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts index 420e4fddc..b94f7757c 100644 --- a/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts +++ b/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts @@ -21,6 +21,7 @@ import { ConfirmPayResultType, Duration, durationFromSpec, + MerchantApiClient, PreparePayResultType, } from "@gnu-taler/taler-util"; import { @@ -31,11 +32,10 @@ import { makeNoFeeCoinConfig } from "../harness/denomStructures.js"; import { BankService, ExchangeService, + getPayto, GlobalTestState, MerchantService, setupDb, - getPayto, - MerchantApiClient, } from "../harness/harness.js"; import { applyTimeTravelV2, diff --git a/packages/taler-harness/src/integrationtests/test-tipping.ts b/packages/taler-harness/src/integrationtests/test-tipping.ts index 93855f546..f4a7c020e 100644 --- a/packages/taler-harness/src/integrationtests/test-tipping.ts +++ b/packages/taler-harness/src/integrationtests/test-tipping.ts @@ -17,18 +17,17 @@ /** * Imports. */ +import { + MerchantApiClient, + TransactionMajorState, +} from "@gnu-taler/taler-util"; import { BankAccessApiClient, WalletApiOperation, WireGatewayApiClient, } from "@gnu-taler/taler-wallet-core"; -import { - GlobalTestState, - MerchantApiClient, - getWireMethodForTest, -} from "../harness/harness.js"; +import { GlobalTestState, getWireMethodForTest } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; -import { TransactionMajorState } from "@gnu-taler/taler-util"; /** * Run test for basic, bank-integrated withdrawal. diff --git a/packages/taler-harness/src/integrationtests/test-wallet-backup-doublespend.ts b/packages/taler-harness/src/integrationtests/test-wallet-backup-doublespend.ts index 62ae89137..c761c4fb0 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-backup-doublespend.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-backup-doublespend.ts @@ -17,9 +17,9 @@ /** * Imports. */ -import { PreparePayResultType } from "@gnu-taler/taler-util"; +import { MerchantApiClient, PreparePayResultType } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { GlobalTestState, MerchantApiClient } from "../harness/harness.js"; +import { GlobalTestState } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, createWalletDaemonWithClient, @@ -126,11 +126,9 @@ export async function runWalletBackupDoublespendTest(t: GlobalTestState) { }, }); - let orderStatus = await merchantClient.queryPrivateOrderStatus( - { - orderId: orderResp.order_id, - }, - ); + let orderStatus = await merchantClient.queryPrivateOrderStatus({ + orderId: orderResp.order_id, + }); t.assertTrue(orderStatus.order_status === "unpaid"); diff --git a/packages/taler-harness/src/integrationtests/test-wallet-balance.ts b/packages/taler-harness/src/integrationtests/test-wallet-balance.ts index 9711aff26..243c90e2e 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-balance.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-balance.ts @@ -17,9 +17,13 @@ /** * Imports. */ -import { Amounts, PreparePayResultType } from "@gnu-taler/taler-util"; +import { + Amounts, + MerchantApiClient, + PreparePayResultType, +} from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { GlobalTestState, MerchantApiClient } from "../harness/harness.js"; +import { GlobalTestState } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, withdrawViaBankV2, diff --git a/packages/taler-util/src/index.ts b/packages/taler-util/src/index.ts index cfd0f7c47..0b75619ab 100644 --- a/packages/taler-util/src/index.ts +++ b/packages/taler-util/src/index.ts @@ -39,3 +39,5 @@ export * from "./merchant-api-types.js"; export * from "./errors.js"; export * from "./iban.js"; export * from "./transaction-test-data.js"; +export * from "./libeufin-api-types.js"; +export * from "./MerchantApiClient.js"; diff --git a/packages/taler-util/src/merchant-api-types.ts b/packages/taler-util/src/merchant-api-types.ts index ce30aa054..9933b93dc 100644 --- a/packages/taler-util/src/merchant-api-types.ts +++ b/packages/taler-util/src/merchant-api-types.ts @@ -47,7 +47,7 @@ import { WireAccount, codecForWireAccount, codecForList, - HashCodeString, + FacadeCredentials, } from "@gnu-taler/taler-util"; export interface MerchantPostOrderRequest { @@ -401,21 +401,3 @@ export interface AccountAddDetails { // To really delete credentials, set them to the type: "none". credit_facade_credentials?: FacadeCredentials; } - -export type FacadeCredentials = - | NoFacadeCredentials - | BasicAuthFacadeCredentials; - -export interface NoFacadeCredentials { - type: "none"; -} - -export interface BasicAuthFacadeCredentials { - type: "basic"; - - // Username to use to authenticate - username: string; - - // Password to use to authenticate - password: string; -} -- cgit v1.2.3 From 3ee3ab3cedf64ea643055a5b99ae5d35385ea037 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 6 Sep 2023 13:43:46 +0200 Subject: harness: remove excludeByDefault --- packages/taler-harness/src/index.ts | 3 - .../src/integrationtests/test-bank-api.ts | 2 + .../src/integrationtests/test-claim-loop.ts | 2 + .../src/integrationtests/test-clause-schnorr.ts | 2 +- .../src/integrationtests/test-deposit.ts | 2 + .../test-libeufin-api-sandbox-camt.ts | 2 +- .../test-libeufin-nexus-balance.ts | 2 +- .../src/integrationtests/test-revocation.ts | 2 +- .../src/integrationtests/test-withdrawal-huge.ts | 3 +- .../src/integrationtests/testrunner.ts | 74 +++++++++------------- 10 files changed, 43 insertions(+), 51 deletions(-) (limited to 'packages/taler-harness/src/integrationtests/test-claim-loop.ts') diff --git a/packages/taler-harness/src/index.ts b/packages/taler-harness/src/index.ts index 534aec8c7..f5d4fd2c2 100644 --- a/packages/taler-harness/src/index.ts +++ b/packages/taler-harness/src/index.ts @@ -503,9 +503,6 @@ testingCli if (t.suites.length > 0) { s += ` (suites: ${t.suites.join(",")})`; } - if (t.excludeByDefault) { - s += ` [excluded by default]`; - } if (t.experimental) { s += ` [experimental]`; } diff --git a/packages/taler-harness/src/integrationtests/test-bank-api.ts b/packages/taler-harness/src/integrationtests/test-bank-api.ts index 77a13b791..1c359732e 100644 --- a/packages/taler-harness/src/integrationtests/test-bank-api.ts +++ b/packages/taler-harness/src/integrationtests/test-bank-api.ts @@ -145,3 +145,5 @@ export async function runBankApiTest(t: GlobalTestState) { balResp.balance.credit_debit_indicator === CreditDebitIndicator.Debit, ); } + +runBankApiTest.suites = ["fakebank"] \ No newline at end of file diff --git a/packages/taler-harness/src/integrationtests/test-claim-loop.ts b/packages/taler-harness/src/integrationtests/test-claim-loop.ts index 652df72ec..a424e0101 100644 --- a/packages/taler-harness/src/integrationtests/test-claim-loop.ts +++ b/packages/taler-harness/src/integrationtests/test-claim-loop.ts @@ -78,3 +78,5 @@ export async function runClaimLoopTest(t: GlobalTestState) { await t.shutdown(); } + +runClaimLoopTest.suites = ["merchant"]; \ No newline at end of file diff --git a/packages/taler-harness/src/integrationtests/test-clause-schnorr.ts b/packages/taler-harness/src/integrationtests/test-clause-schnorr.ts index 9a839b677..a5ad382a7 100644 --- a/packages/taler-harness/src/integrationtests/test-clause-schnorr.ts +++ b/packages/taler-harness/src/integrationtests/test-clause-schnorr.ts @@ -100,4 +100,4 @@ export async function runClauseSchnorrTest(t: GlobalTestState) { } runClauseSchnorrTest.suites = ["experimental-wallet"]; -runClauseSchnorrTest.excludeByDefault = true; +runClauseSchnorrTest.experimental = true; diff --git a/packages/taler-harness/src/integrationtests/test-deposit.ts b/packages/taler-harness/src/integrationtests/test-deposit.ts index 8ea3fc12e..7e1bb2a5c 100644 --- a/packages/taler-harness/src/integrationtests/test-deposit.ts +++ b/packages/taler-harness/src/integrationtests/test-deposit.ts @@ -102,3 +102,5 @@ export async function runDepositTest(t: GlobalTestState) { // deposit and wire fees. t.assertDeepEqual(transactions.transactions[1].amountRaw, "TESTKUDOS:9.79"); } + +runDepositTest.suites = ["wallet"]; diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-api-sandbox-camt.ts b/packages/taler-harness/src/integrationtests/test-libeufin-api-sandbox-camt.ts index 239bab334..22b411dc2 100644 --- a/packages/taler-harness/src/integrationtests/test-libeufin-api-sandbox-camt.ts +++ b/packages/taler-harness/src/integrationtests/test-libeufin-api-sandbox-camt.ts @@ -72,5 +72,5 @@ export async function runLibeufinApiSandboxCamtTest(t: GlobalTestState) { let ret = await LibeufinSandboxApi.getCamt053(sandbox, "mock-account-1"); console.log(ret); } -runLibeufinApiSandboxCamtTest.excludeByDefault = true; +runLibeufinApiSandboxCamtTest.experimental = true; runLibeufinApiSandboxCamtTest.suites = ["libeufin"]; diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-nexus-balance.ts b/packages/taler-harness/src/integrationtests/test-libeufin-nexus-balance.ts index 68b0174cc..868f93759 100644 --- a/packages/taler-harness/src/integrationtests/test-libeufin-nexus-balance.ts +++ b/packages/taler-harness/src/integrationtests/test-libeufin-nexus-balance.ts @@ -114,4 +114,4 @@ export async function runLibeufinNexusBalanceTest(t: GlobalTestState) { } runLibeufinNexusBalanceTest.suites = ["libeufin"]; -runLibeufinNexusBalanceTest.excludeByDefault = true; +runLibeufinNexusBalanceTest.experimental = true; diff --git a/packages/taler-harness/src/integrationtests/test-revocation.ts b/packages/taler-harness/src/integrationtests/test-revocation.ts index 233780674..0cb6987ad 100644 --- a/packages/taler-harness/src/integrationtests/test-revocation.ts +++ b/packages/taler-harness/src/integrationtests/test-revocation.ts @@ -233,4 +233,4 @@ export async function runRevocationTest(t: GlobalTestState) { runRevocationTest.timeoutMs = 120000; runRevocationTest.suites = ["wallet"]; -runRevocationTest.excludeByDefault = true; +runRevocationTest.experimental = true; diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-huge.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-huge.ts index a9d544ee0..8777b19e2 100644 --- a/packages/taler-harness/src/integrationtests/test-withdrawal-huge.ts +++ b/packages/taler-harness/src/integrationtests/test-withdrawal-huge.ts @@ -114,4 +114,5 @@ export async function runWithdrawalHugeTest(t: GlobalTestState) { } runWithdrawalHugeTest.suites = ["wallet-perf"]; -runWithdrawalHugeTest.excludeByDefault = true; +// FIXME: Should not be "experimental" but "slow" or something similar. +runWithdrawalHugeTest.experimental = true; diff --git a/packages/taler-harness/src/integrationtests/testrunner.ts b/packages/taler-harness/src/integrationtests/testrunner.ts index 3a49cf73c..66bd87a59 100644 --- a/packages/taler-harness/src/integrationtests/testrunner.ts +++ b/packages/taler-harness/src/integrationtests/testrunner.ts @@ -14,39 +14,39 @@ GNU Taler; see the file COPYING. If not, see */ -import { - CancellationToken, - Logger, - minimatch, - setGlobalLogLevelFromString, -} from "@gnu-taler/taler-util"; +import { CancellationToken, Logger, minimatch } from "@gnu-taler/taler-util"; import * as child_process from "child_process"; +import { spawnSync } from "child_process"; import * as fs from "fs"; import * as os from "os"; import * as path from "path"; import url from "url"; import { GlobalTestState, - runCommand, + TestRunResult, runTestWithState, shouldLingerInTest, - TestRunResult, } from "../harness/harness.js"; -import { spawnSync } from "child_process"; +import { getSharedTestDir } from "../harness/helpers.js"; import { runAgeRestrictionsMerchantTest } from "./test-age-restrictions-merchant.js"; +import { runAgeRestrictionsMixedMerchantTest } from "./test-age-restrictions-mixed-merchant.js"; +import { runAgeRestrictionsPeerTest } from "./test-age-restrictions-peer.js"; import { runBankApiTest } from "./test-bank-api.js"; import { runClaimLoopTest } from "./test-claim-loop.js"; import { runClauseSchnorrTest } from "./test-clause-schnorr.js"; import { runDenomUnofferedTest } from "./test-denom-unoffered.js"; import { runDepositTest } from "./test-deposit.js"; +import { runExchangeDepositTest } from "./test-exchange-deposit.js"; import { runExchangeManagementTest } from "./test-exchange-management.js"; +import { runExchangePurseTest } from "./test-exchange-purse.js"; import { runExchangeTimetravelTest } from "./test-exchange-timetravel.js"; import { runFeeRegressionTest } from "./test-fee-regression.js"; import { runForcedSelectionTest } from "./test-forced-selection.js"; +import { runKycTest } from "./test-kyc.js"; import { runLibeufinApiBankaccountTest } from "./test-libeufin-api-bankaccount.js"; import { runLibeufinApiBankconnectionTest } from "./test-libeufin-api-bankconnection.js"; -import { runLibeufinApiFacadeTest } from "./test-libeufin-api-facade.js"; import { runLibeufinApiFacadeBadRequestTest } from "./test-libeufin-api-facade-bad-request.js"; +import { runLibeufinApiFacadeTest } from "./test-libeufin-api-facade.js"; import { runLibeufinApiPermissionsTest } from "./test-libeufin-api-permissions.js"; import { runLibeufinApiSandboxCamtTest } from "./test-libeufin-api-sandbox-camt.js"; import { runLibeufinApiSandboxTransactionsTest } from "./test-libeufin-api-sandbox-transactions.js"; @@ -58,64 +58,58 @@ import { runLibeufinC5xTest } from "./test-libeufin-c5x.js"; import { runLibeufinAnastasisFacadeTest } from "./test-libeufin-facade-anastasis.js"; import { runLibeufinKeyrotationTest } from "./test-libeufin-keyrotation.js"; import { runLibeufinNexusBalanceTest } from "./test-libeufin-nexus-balance.js"; -import { runLibeufinRefundTest } from "./test-libeufin-refund.js"; import { runLibeufinRefundMultipleUsersTest } from "./test-libeufin-refund-multiple-users.js"; +import { runLibeufinRefundTest } from "./test-libeufin-refund.js"; import { runLibeufinSandboxWireTransferCliTest } from "./test-libeufin-sandbox-wire-transfer-cli.js"; import { runLibeufinTutorialTest } from "./test-libeufin-tutorial.js"; import { runMerchantExchangeConfusionTest } from "./test-merchant-exchange-confusion.js"; -import { runMerchantInstancesTest } from "./test-merchant-instances.js"; import { runMerchantInstancesDeleteTest } from "./test-merchant-instances-delete.js"; import { runMerchantInstancesUrlsTest } from "./test-merchant-instances-urls.js"; +import { runMerchantInstancesTest } from "./test-merchant-instances.js"; import { runMerchantLongpollingTest } from "./test-merchant-longpolling.js"; import { runMerchantRefundApiTest } from "./test-merchant-refund-api.js"; import { runMerchantSpecPublicOrdersTest } from "./test-merchant-spec-public-orders.js"; import { runPayPaidTest } from "./test-pay-paid.js"; -import { runPaymentTest } from "./test-payment.js"; +import { runPaymentAbortTest } from "./test-payment-abort.js"; import { runPaymentClaimTest } from "./test-payment-claim.js"; +import { runPaymentExpiredTest } from "./test-payment-expired.js"; import { runPaymentFaultTest } from "./test-payment-fault.js"; import { runPaymentForgettableTest } from "./test-payment-forgettable.js"; import { runPaymentIdempotencyTest } from "./test-payment-idempotency.js"; import { runPaymentMultipleTest } from "./test-payment-multiple.js"; +import { runPaymentShareTest } from "./test-payment-share.js"; +import { runPaymentTemplateTest } from "./test-payment-template.js"; import { runPaymentTransientTest } from "./test-payment-transient.js"; import { runPaymentZeroTest } from "./test-payment-zero.js"; +import { runPaymentTest } from "./test-payment.js"; import { runPaywallFlowTest } from "./test-paywall-flow.js"; +import { runPeerRepairTest } from "./test-peer-repair.js"; import { runPeerToPeerPullTest } from "./test-peer-to-peer-pull.js"; import { runPeerToPeerPushTest } from "./test-peer-to-peer-push.js"; -import { runRefundTest } from "./test-refund.js"; import { runRefundAutoTest } from "./test-refund-auto.js"; import { runRefundGoneTest } from "./test-refund-gone.js"; import { runRefundIncrementalTest } from "./test-refund-incremental.js"; +import { runRefundTest } from "./test-refund.js"; import { runRevocationTest } from "./test-revocation.js"; +import { runSimplePaymentTest } from "./test-simple-payment.js"; +import { runStoredBackupsTest } from "./test-stored-backups.js"; import { runTimetravelAutorefreshTest } from "./test-timetravel-autorefresh.js"; import { runTimetravelWithdrawTest } from "./test-timetravel-withdraw.js"; import { runTippingTest } from "./test-tipping.js"; +import { runTermOfServiceFormatTest } from "./test-tos-format.js"; import { runWalletBackupBasicTest } from "./test-wallet-backup-basic.js"; import { runWalletBackupDoublespendTest } from "./test-wallet-backup-doublespend.js"; +import { runWalletBalanceTest } from "./test-wallet-balance.js"; +import { runWalletCryptoWorkerTest } from "./test-wallet-cryptoworker.js"; import { runWalletDblessTest } from "./test-wallet-dbless.js"; +import { runWalletNotificationsTest } from "./test-wallet-notifications.js"; import { runWallettestingTest } from "./test-wallettesting.js"; import { runWithdrawalAbortBankTest } from "./test-withdrawal-abort-bank.js"; import { runWithdrawalBankIntegratedTest } from "./test-withdrawal-bank-integrated.js"; import { runWithdrawalFakebankTest } from "./test-withdrawal-fakebank.js"; -import { runWithdrawalManualTest } from "./test-withdrawal-manual.js"; -import { runAgeRestrictionsPeerTest } from "./test-age-restrictions-peer.js"; -import { runWalletNotificationsTest } from "./test-wallet-notifications.js"; -import { runAgeRestrictionsMixedMerchantTest } from "./test-age-restrictions-mixed-merchant.js"; -import { runWalletCryptoWorkerTest } from "./test-wallet-cryptoworker.js"; -import { runWithdrawalHugeTest } from "./test-withdrawal-huge.js"; -import { runKycTest } from "./test-kyc.js"; -import { runPaymentAbortTest } from "./test-payment-abort.js"; import { runWithdrawalFeesTest } from "./test-withdrawal-fees.js"; -import { runWalletBalanceTest } from "./test-wallet-balance.js"; -import { runPaymentTemplateTest } from "./test-payment-template.js"; -import { runExchangeDepositTest } from "./test-exchange-deposit.js"; -import { runPeerRepairTest } from "./test-peer-repair.js"; -import { runPaymentShareTest } from "./test-payment-share.js"; -import { runSimplePaymentTest } from "./test-simple-payment.js"; -import { runTermOfServiceFormatTest } from "./test-tos-format.js"; -import { runExchangePurseTest } from "./test-exchange-purse.js"; -import { getSharedTestDir } from "../harness/helpers.js"; -import { runStoredBackupsTest } from "./test-stored-backups.js"; -import { runPaymentExpiredTest } from "./test-payment-expired.js"; +import { runWithdrawalHugeTest } from "./test-withdrawal-huge.js"; +import { runWithdrawalManualTest } from "./test-withdrawal-manual.js"; /** * Test runner. @@ -128,7 +122,6 @@ const logger = new Logger("testrunner.ts"); interface TestMainFunction { (t: GlobalTestState): Promise; timeoutMs?: number; - excludeByDefault?: boolean; experimental?: boolean; suites?: string[]; } @@ -232,7 +225,6 @@ export interface TestRunSpec { export interface TestInfo { name: string; suites: string[]; - excludeByDefault: boolean; experimental: boolean; } @@ -337,19 +329,16 @@ export async function runTests(spec: TestRunSpec) { continue; } + if (testCase.experimental && !spec.includeExperimental) { + continue; + } + if (suites) { const ts = new Set(testCase.suites ?? []); const intersection = new Set([...suites].filter((x) => ts.has(x))); if (intersection.size === 0) { continue; } - } else { - if (testCase.excludeByDefault) { - continue; - } - if (testCase.experimental && !spec.includeExperimental) { - continue; - } } if (spec.dryRun) { @@ -525,7 +514,6 @@ export function getTestInfo(): TestInfo[] { return allTests.map((x) => ({ name: getTestName(x), suites: x.suites ?? [], - excludeByDefault: x.excludeByDefault ?? false, experimental: x.experimental ?? false, })); } -- cgit v1.2.3