gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated (038e42106 -> 7033150c8)


From: gnunet
Subject: [taler-wallet-core] branch master updated (038e42106 -> 7033150c8)
Date: Mon, 13 Nov 2023 18:36:37 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a change to branch master
in repository wallet-core.

    from 038e42106 fix inject support not triggering
     new 58c16b2dd harness: towards fixing the kyc integration test
     new 7033150c8 harness: support tests with multiple exchanges

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 packages/taler-harness/src/harness/harness.ts      | 27 +++++++--
 .../taler-harness/src/integrationtests/test-kyc.ts | 12 ++++
 .../src/integrationtests/testrunner.ts             |  2 +
 packages/taler-wallet-core/src/wallet.ts           | 70 ++++++++++------------
 4 files changed, 69 insertions(+), 42 deletions(-)

diff --git a/packages/taler-harness/src/harness/harness.ts 
b/packages/taler-harness/src/harness/harness.ts
index 5f90c8daf..5e993b95e 100644
--- a/packages/taler-harness/src/harness/harness.ts
+++ b/packages/taler-harness/src/harness/harness.ts
@@ -435,8 +435,20 @@ export interface DbInfo {
   dbname: string;
 }
 
-export async function setupDb(t: GlobalTestState): Promise<DbInfo> {
-  const dbname = "taler-integrationtest";
+export interface SetupDbOpts {
+  nameSuffix?: string;
+}
+
+export async function setupDb(
+  t: GlobalTestState,
+  opts: SetupDbOpts = {},
+): Promise<DbInfo> {
+  let dbname: string;
+  if (!opts.nameSuffix) {
+    dbname = "taler-integrationtest";
+  } else {
+    dbname = `taler-integrationtest-${opts.nameSuffix}`;
+  }
   try {
     await runCommand(t, "dropdb", "dropdb", [dbname]);
   } catch (e: any) {
@@ -479,11 +491,15 @@ export interface FakeBankConfig {
   httpPort: number;
 }
 
-function setTalerPaths(config: Configuration, home: string) {
+/**
+ * @param name additional component name, needed when launching multiple 
instances of the same component
+ */
+function setTalerPaths(config: Configuration, home: string, name?: string) {
   config.setString("paths", "taler_home", home);
   // We need to make sure that the path of taler_runtime_dir isn't too long,
   // as it contains unix domain sockets (108 character limit).
-  const runDir = fs.mkdtempSync("/tmp/taler-test-");
+  const extraName = name != null ? `${name}-` : "";
+  const runDir = fs.mkdtempSync(`/tmp/taler-test-${extraName}`);
   config.setString("paths", "taler_runtime_dir", runDir);
   config.setString(
     "paths",
@@ -999,7 +1015,7 @@ export class ExchangeService implements 
ExchangeServiceInterface {
   static create(gc: GlobalTestState, e: ExchangeConfig) {
     const testDir = e.overrideTestDir ?? gc.testDir;
     const config = new Configuration();
-    setTalerPaths(config, testDir + "/talerhome");
+    setTalerPaths(config, `${testDir}/talerhome-exchange-${e.name}`, e.name);
     config.setString("taler", "currency", e.currency);
     // Required by the exchange but not really used yet.
     config.setString("exchange", "aml_threshold", `${e.currency}:1000000`);
@@ -1024,6 +1040,7 @@ export class ExchangeService implements 
ExchangeServiceInterface {
       "master_priv_file",
       "${TALER_DATA_HOME}/exchange/offline-keys/master.priv",
     );
+    config.setString("exchange", "base_url", 
`http://localhost:${e.httpPort}/`);
     config.setString("exchange", "serve", "tcp");
     config.setString("exchange", "port", `${e.httpPort}`);
 
diff --git a/packages/taler-harness/src/integrationtests/test-kyc.ts 
b/packages/taler-harness/src/integrationtests/test-kyc.ts
index 319e8828f..be6e704ee 100644
--- a/packages/taler-harness/src/integrationtests/test-kyc.ts
+++ b/packages/taler-harness/src/integrationtests/test-kyc.ts
@@ -26,6 +26,7 @@ import {
   TransactionMajorState,
   TransactionMinorState,
   TransactionType,
+  encodeCrock,
 } from "@gnu-taler/taler-util";
 import { createPlatformHttpLib } from "@gnu-taler/taler-util/http";
 import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
@@ -129,6 +130,7 @@ export async function createKycTestkudosEnvironment(
       "kyc_oauth2_info_url",
       "http://localhost:6666/oauth/v2/info";,
     );
+    config.setString(myprov, "kyc_oauth2_converter_helper", "/bin/cat");
     config.setString(myprov, "kyc_oauth2_client_id", "taler-exchange");
     config.setString(myprov, "kyc_oauth2_client_secret", "exchange-secret");
     config.setString(myprov, "kyc_oauth2_post_url", "https://taler.net";);
@@ -239,8 +241,13 @@ async function runTestfakeKycService(): 
Promise<TestfakeKycService> {
       if (!redirUriUnparsed) {
         throw Error("missing redirect_url");
       }
+      const state = qp.get("state");
+      if (!state) {
+        throw Error("missing state");
+      }
       const redirUri = new URL(redirUriUnparsed);
       redirUri.searchParams.set("code", "code_is_ok");
+      redirUri.searchParams.set("state", state);
       res.writeHead(200, { "Content-Type": "application/json" });
       res.end(
         JSON.stringify({
@@ -388,6 +395,11 @@ export async function runKycTest(t: GlobalTestState) {
   const proofHttpResp = await httpLib.fetch(kycProofUrl);
   logger.info(`proof resp status ${proofHttpResp.status}`);
   logger.info(`resp headers ${j2s(proofHttpResp.headers.toJSON())}`);
+  if (!(proofHttpResp.status >= 200 && proofHttpResp.status <= 299)) {
+    logger.error("kyc proof failed");
+    logger.info(await proofHttpResp.text());
+    t.assertTrue(false);
+  }
 
   // Now that KYC is done, withdrawal should finally succeed.
 
diff --git a/packages/taler-harness/src/integrationtests/testrunner.ts 
b/packages/taler-harness/src/integrationtests/testrunner.ts
index cf5691fe3..968204d78 100644
--- a/packages/taler-harness/src/integrationtests/testrunner.ts
+++ b/packages/taler-harness/src/integrationtests/testrunner.ts
@@ -93,6 +93,7 @@ import { runWithdrawalHugeTest } from 
"./test-withdrawal-huge.js";
 import { runWithdrawalManualTest } from "./test-withdrawal-manual.js";
 import { runWalletGenDbTest } from "./test-wallet-gendb.js";
 import { runLibeufinBankTest } from "./test-libeufin-bank.js";
+import { runMultiExchangeTest } from "./test-multiexchange.js";
 
 /**
  * Test runner.
@@ -146,6 +147,7 @@ const allTests: TestMainFunction[] = [
   runPaymentZeroTest,
   runPayPaidTest,
   runPeerRepairTest,
+  runMultiExchangeTest,
   runWalletBalanceTest,
   runPaywallFlowTest,
   runPeerToPeerPullTest,
diff --git a/packages/taler-wallet-core/src/wallet.ts 
b/packages/taler-wallet-core/src/wallet.ts
index 978ce4c39..0694aef8a 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -22,20 +22,26 @@
 /**
  * Imports.
  */
+import { IDBFactory } from "@gnu-taler/idb-bridge";
 import {
   AbsoluteTime,
+  AmountString,
   Amounts,
   CoinDumpJson,
   CoinRefreshRequest,
   CoinStatus,
   CoreApiResponse,
+  CreateStoredBackupResponse,
+  DeleteStoredBackupRequest,
   DenomOperationMap,
   DenominationInfo,
   Duration,
   ExchangeDetailedResponse,
   ExchangeListItem,
   ExchangesListResponse,
+  ExchangesShortListResponse,
   FeeDescription,
+  GetCurrencySpecificationResponse,
   GetExchangeTosResult,
   InitResponse,
   KnownBankAccounts,
@@ -44,9 +50,13 @@ import {
   ManualWithdrawalDetails,
   MerchantUsingTemplateDetails,
   NotificationType,
+  RecoverStoredBackupRequest,
   RefreshReason,
+  StoredBackupList,
   TalerError,
   TalerErrorCode,
+  TaskThrottler,
+  TestingWaitTransactionRequest,
   TransactionState,
   TransactionType,
   URL,
@@ -69,6 +79,7 @@ import {
   codecForConfirmPeerPushPaymentRequest,
   codecForConvertAmountRequest,
   codecForCreateDepositGroupRequest,
+  codecForDeleteStoredBackupRequest,
   codecForDeleteTransactionRequest,
   codecForFailTransactionRequest,
   codecForForceRefreshRequest,
@@ -76,6 +87,7 @@ import {
   codecForGetAmountRequest,
   codecForGetBalanceDetailRequest,
   codecForGetContractTermsDetails,
+  codecForGetCurrencyInfoRequest,
   codecForGetExchangeTosRequest,
   codecForGetWithdrawalDetailsForAmountRequest,
   codecForGetWithdrawalDetailsForUri,
@@ -84,6 +96,7 @@ import {
   codecForInitiatePeerPushDebitRequest,
   codecForIntegrationTestArgs,
   codecForIntegrationTestV2Args,
+  codecForListExchangesForScopedCurrencyRequest,
   codecForListKnownBankAccounts,
   codecForMerchantPostOrderResponse,
   codecForPrepareDepositRequest,
@@ -93,19 +106,22 @@ import {
   codecForPreparePeerPushCreditRequest,
   codecForPrepareRefundRequest,
   codecForPrepareRewardRequest,
+  codecForRecoverStoredBackupRequest,
   codecForResumeTransaction,
   codecForRetryTransactionRequest,
   codecForSetCoinSuspendedRequest,
   codecForSetWalletDeviceIdRequest,
+  codecForSharePaymentRequest,
   codecForStartRefundQueryRequest,
   codecForSuspendTransaction,
   codecForTestPayArgs,
+  codecForTestingSetTimetravelRequest,
   codecForTransactionByIdRequest,
   codecForTransactionsRequest,
+  codecForUpdateExchangeEntryRequest,
   codecForUserAttentionByIdRequest,
   codecForUserAttentionsRequest,
   codecForValidateIbanRequest,
-  codecForWithdrawFakebankRequest,
   codecForWithdrawTestBalance,
   constructPayUri,
   durationFromSpec,
@@ -115,26 +131,8 @@ import {
   parsePayTemplateUri,
   parsePaytoUri,
   sampleWalletCoreTransactions,
-  validateIban,
-  codecForSharePaymentRequest,
-  GetCurrencySpecificationResponse,
-  codecForGetCurrencyInfoRequest,
-  CreateStoredBackupResponse,
-  StoredBackupList,
-  codecForDeleteStoredBackupRequest,
-  DeleteStoredBackupRequest,
-  RecoverStoredBackupRequest,
-  codecForRecoverStoredBackupRequest,
-  codecForTestingSetTimetravelRequest,
   setDangerousTimetravel,
-  TestingWaitTransactionRequest,
-  codecForUpdateExchangeEntryRequest,
-  codecForListExchangesForScopedCurrencyRequest,
-  ListExchangesForScopedCurrencyRequest,
-  ExchangesShortListResponse,
-  AmountString,
-  RequestThrottler,
-  TaskThrottler,
+  validateIban,
 } from "@gnu-taler/taler-util";
 import type { HttpRequestLibrary } from "@gnu-taler/taler-util/http";
 import { readSuccessResponseJsonOrThrow } from "@gnu-taler/taler-util/http";
@@ -147,7 +145,6 @@ import {
   CoinSourceType,
   ConfigRecordKey,
   DenominationRecord,
-  ExchangeDetailsRecord,
   WalletStoresV1,
   clearDatabase,
   exportDb,
@@ -253,22 +250,22 @@ import {
   createRefreshGroup,
   processRefreshGroup,
 } from "./operations/refresh.js";
+import {
+  acceptTip,
+  computeRewardTransactionStatus,
+  prepareTip,
+  processTip,
+} from "./operations/reward.js";
 import {
   runIntegrationTest,
   runIntegrationTest2,
   testPay,
   waitTransactionState,
-  waitUntilTransactionsFinal,
   waitUntilRefreshesDone,
-  withdrawTestBalance,
   waitUntilTasksProcessed,
+  waitUntilTransactionsFinal,
+  withdrawTestBalance,
 } from "./operations/testing.js";
-import {
-  acceptTip,
-  computeRewardTransactionStatus,
-  prepareTip,
-  processTip,
-} from "./operations/reward.js";
 import {
   abortTransaction,
   deleteTransaction,
@@ -295,6 +292,13 @@ import {
   selectBestForOverlappingDenominations,
   selectMinimumFee,
 } from "./util/denominations.js";
+import {
+  convertDepositAmount,
+  convertPeerPushAmount,
+  convertWithdrawalAmount,
+  getMaxDepositAmount,
+  getMaxPeerPushAmount,
+} from "./util/instructedAmountConversion.js";
 import { checkDbInvariant } from "./util/invariants.js";
 import {
   AsyncCondition,
@@ -320,14 +324,6 @@ import {
   WalletCoreApiClient,
   WalletCoreResponseType,
 } from "./wallet-api-types.js";
-import {
-  convertDepositAmount,
-  getMaxDepositAmount,
-  convertPeerPushAmount,
-  getMaxPeerPushAmount,
-  convertWithdrawalAmount,
-} from "./util/instructedAmountConversion.js";
-import { IDBFactory } from "@gnu-taler/idb-bridge";
 
 const logger = new Logger("wallet.ts");
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]