gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: delay in test for debugging


From: gnunet
Subject: [taler-wallet-core] branch master updated: delay in test for debugging
Date: Fri, 15 Jan 2021 13:48:38 +0100

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

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

The following commit(s) were added to refs/heads/master by this push:
     new c30bcc5e delay in test for debugging
c30bcc5e is described below

commit c30bcc5e7eec6300bc89c9ad95465b05d50fffb8
Author: Florian Dold <florian@dold.me>
AuthorDate: Fri Jan 15 13:48:33 2021 +0100

    delay in test for debugging
---
 .../src/integrationtests/harness.ts                |  11 ++-
 .../src/integrationtests/test-revocation.ts        | 107 ++++++++++++++++++---
 2 files changed, 99 insertions(+), 19 deletions(-)

diff --git a/packages/taler-wallet-cli/src/integrationtests/harness.ts 
b/packages/taler-wallet-cli/src/integrationtests/harness.ts
index 6a9d694e..b294fd15 100644
--- a/packages/taler-wallet-cli/src/integrationtests/harness.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/harness.ts
@@ -27,7 +27,6 @@
 import * as util from "util";
 import * as fs from "fs";
 import * as path from "path";
-import * as os from "os";
 import * as http from "http";
 import { deepStrictEqual } from "assert";
 import { ChildProcess, spawn } from "child_process";
@@ -817,6 +816,12 @@ export class ExchangeService implements 
ExchangeServiceInterface {
     );
   }
 
+  changeConfig(f: (config: Configuration) => void) {
+    const config = Configuration.load(this.configFilename);
+    f(config);
+    config.write(this.configFilename);
+  }
+
   static create(gc: GlobalTestState, e: ExchangeConfig) {
     const config = new Configuration();
     config.setString("taler", "currency", e.currency);
@@ -846,10 +851,6 @@ export class ExchangeService implements 
ExchangeServiceInterface {
     );
     config.setString("exchange", "serve", "tcp");
     config.setString("exchange", "port", `${e.httpPort}`);
-    config.setString("exchange", "signkey_duration", "4 weeks");
-    config.setString("exchange", "legal_duraction", "2 years");
-    config.setString("exchange", "lookahead_sign", "32 weeks 1 day");
-    config.setString("exchange", "lookahead_provide", "4 weeks 1 day");
 
     config.setString("exchangedb-postgres", "config", e.database);
 
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-revocation.ts 
b/packages/taler-wallet-cli/src/integrationtests/test-revocation.ts
index bb0c5921..6e3a8f7a 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-revocation.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-revocation.ts
@@ -23,11 +23,14 @@ import {
   ExchangeService,
   MerchantService,
   WalletCli,
+  setupDb,
+  BankService,
+  delayMs,
 } from "./harness";
 import {
-  createSimpleTestkudosEnvironment,
   withdrawViaBank,
   makeTestPayment,
+  SimpleTestEnvironment,
 } from "./helpers";
 
 async function revokeAllWalletCoins(req: {
@@ -45,21 +48,58 @@ async function revokeAllWalletCoins(req: {
   for (const x of usedDenomHashes.values()) {
     await exchange.revokeDenomination(x);
   }
-  await exchange.stop();
-  await exchange.start();
-  await exchange.pingUntilAvailable();
+  console.log("waiting 30 seconds after revocation");
+  await delayMs(30000);
   await exchange.keyup();
-  await exchange.pingUntilAvailable();
+  console.log("waiting 30 seconds after keyup");
+  await delayMs(30000);
   await merchant.stop();
   await merchant.start();
   await merchant.pingUntilAvailable();
 }
 
-/**
- * Basic time travel test.
- */
-export async function runRevocationTest(t: GlobalTestState) {
-  // Set up test environment
+async function createTestEnvironment(
+  t: GlobalTestState,
+): Promise<SimpleTestEnvironment> {
+  const db = await setupDb(t);
+
+  const bank = await BankService.create(t, {
+    allowRegistrations: true,
+    currency: "TESTKUDOS",
+    database: db.connStr,
+    httpPort: 8082,
+  });
+
+  const exchange = ExchangeService.create(t, {
+    name: "testexchange-1",
+    currency: "TESTKUDOS",
+    httpPort: 8081,
+    database: db.connStr,
+  });
+
+  const merchant = await MerchantService.create(t, {
+    name: "testmerchant-1",
+    currency: "TESTKUDOS",
+    httpPort: 8083,
+    database: db.connStr,
+  });
+
+  exchange.changeConfig((config) => {
+    config.setString("taler-helper-crypto-eddsa", "lookahead_sign", "20 s");
+    config.setString("taler-helper-crypto-rsa", "lookahead_sign", "20 s");
+  });
+
+  const exchangeBankAccount = await bank.createExchangeAccount(
+    "MyExchange",
+    "x",
+  );
+  exchange.addBankAccount("1", exchangeBankAccount);
+
+  bank.setSuggestedExchange(exchange, exchangeBankAccount.accountPaytoUri);
+
+  await bank.start();
+
+  await bank.pingUntilAvailable();
 
   const coin_u1: CoinConfig = {
     durationLegal: "3 years",
@@ -74,17 +114,55 @@ export async function runRevocationTest(t: 
GlobalTestState) {
     feeWithdraw: `TESTKUDOS:0`,
   };
 
-  const {
-    wallet,
-    bank,
+  exchange.addCoinConfigList([coin_u1]);
+
+  await exchange.start();
+  await exchange.pingUntilAvailable();
+
+  merchant.addExchange(exchange);
+
+  await merchant.start();
+  await merchant.pingUntilAvailable();
+
+  await merchant.addInstance({
+    id: "minst1",
+    name: "minst1",
+    paytoUris: ["payto://x-taler-bank/minst1"],
+  });
+
+  await merchant.addInstance({
+    id: "default",
+    name: "Default Instance",
+    paytoUris: [`payto://x-taler-bank/merchant-default`],
+  });
+
+  console.log("setup done!");
+
+  const wallet = new WalletCli(t);
+
+  return {
+    commonDb: db,
     exchange,
     merchant,
-  } = await createSimpleTestkudosEnvironment(t, [coin_u1]);
+    wallet,
+    bank,
+    exchangeBankAccount,
+  };
+}
+
+/**
+ * Basic time travel test.
+ */
+export async function runRevocationTest(t: GlobalTestState) {
+  // Set up test environment
+
+  const { wallet, bank, exchange, merchant } = await createTestEnvironment(t);
 
   // Withdraw digital cash into the wallet.
 
   await withdrawViaBank(t, { wallet, bank, exchange, amount: "TESTKUDOS:15" });
 
+  console.log("revoking first time");
   await revokeAllWalletCoins({ wallet, exchange, merchant });
 
   // FIXME: this shouldn't be necessary once https://bugs.taler.net/n/6565
@@ -114,6 +192,7 @@ export async function runRevocationTest(t: GlobalTestState) 
{
   });
   await wallet.runUntilDone();
 
+  console.log("revoking second time");
   await revokeAllWalletCoins({ wallet, exchange, merchant });
 
   // FIXME: this shouldn't be necessary once https://bugs.taler.net/n/6565

-- 
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]