gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: reduce verbosity a bit, add c


From: gnunet
Subject: [taler-wallet-core] branch master updated: reduce verbosity a bit, add convenience symlink
Date: Thu, 06 Aug 2020 17:50:55 +0200

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 100f4fc5 reduce verbosity a bit, add convenience symlink
100f4fc5 is described below

commit 100f4fc5fbecce527a0c04268829e1b4af33cc3b
Author: Florian Dold <florian.dold@gmail.com>
AuthorDate: Thu Aug 6 21:20:47 2020 +0530

    reduce verbosity a bit, add convenience symlink
---
 packages/taler-integrationtests/src/harness.ts | 63 +++++++++++++++-----------
 1 file changed, 36 insertions(+), 27 deletions(-)

diff --git a/packages/taler-integrationtests/src/harness.ts 
b/packages/taler-integrationtests/src/harness.ts
index 17a21232..ec25ca25 100644
--- a/packages/taler-integrationtests/src/harness.ts
+++ b/packages/taler-integrationtests/src/harness.ts
@@ -63,13 +63,17 @@ interface WaitResult {
 /**
  * Run a shell command, return stdout.
  */
-export async function sh(command: string): Promise<string> {
+export async function sh(
+  t: GlobalTestState,
+  logName: string,
+  command: string,
+): Promise<string> {
   console.log("runing command");
   console.log(command);
   return new Promise((resolve, reject) => {
     const stdoutChunks: Buffer[] = [];
     const proc = spawn(command, {
-      stdio: ["inherit", "pipe", "inherit"],
+      stdio: ["inherit", "pipe", "pipe"],
       shell: true,
     });
     proc.stdout.on("data", (x) => {
@@ -80,6 +84,11 @@ export async function sh(command: string): Promise<string> {
         throw Error("unexpected data chunk type");
       }
     });
+    const stderrLogFileName = path.join(t.testDir, `${logName}-stderr.log`);
+    const stderrLog = fs.createWriteStream(stderrLogFileName, {
+      flags: "a",
+    });
+    proc.stderr.pipe(stderrLog);
     proc.on("exit", (code) => {
       console.log("child process exited");
       if (code != 0) {
@@ -113,22 +122,6 @@ export class ProcessWrapper {
   }
 }
 
-export function makeTempDir(): Promise<string> {
-  return new Promise((resolve, reject) => {
-    fs.mkdtemp(
-      path.join(os.tmpdir(), "taler-integrationtest-"),
-      (err, directory) => {
-        if (err) {
-          reject(err);
-          return;
-        }
-        resolve(directory);
-        console.log(directory);
-      },
-    );
-  });
-}
-
 interface CoinConfig {
   name: string;
   value: string;
@@ -620,13 +613,6 @@ export class ExchangeService implements 
ExchangeServiceInterface {
 
     fs.writeFileSync(masterPrivFile, Buffer.from(exchangeMasterKey.eddsaPriv));
 
-    console.log("writing key to", masterPrivFile);
-    console.log("pub is", talerCrypto.encodeCrock(exchangeMasterKey.eddsaPub));
-    console.log(
-      "priv is",
-      talerCrypto.encodeCrock(exchangeMasterKey.eddsaPriv),
-    );
-
     const cfgFilename = gc.testDir + `/exchange-${e.name}.conf`;
     config.write(cfgFilename);
     return new ExchangeService(gc, e, cfgFilename, exchangeMasterKey);
@@ -873,14 +859,29 @@ function shouldLinger(): boolean {
   return process.env["TALER_TEST_KEEP"] == "1";
 }
 
+function updateCurrentSymlink(testDir: string): void {
+  const currLink = path.join(os.tmpdir(), "taler-integrationtest-current");
+  try {
+    fs.unlinkSync(currLink);
+  } catch (e) {
+    // Ignore
+  }
+  try {
+    fs.symlinkSync(currLink, testDir);
+  } catch (e) {
+    // Ignore
+  }
+}
+
 export function runTest(testMain: (gc: GlobalTestState) => Promise<void>) {
   const main = async () => {
     let gc: GlobalTestState | undefined;
     let ret = 0;
     try {
       gc = new GlobalTestState({
-        testDir: await makeTempDir(),
+        testDir: fs.mkdtempSync("taler-integrationtest-"),
       });
+      updateCurrentSymlink(gc.testDir);
       await testMain(gc);
     } catch (e) {
       console.error("FATAL: test failed with exception", e);
@@ -915,6 +916,8 @@ export class WalletCli {
   ): Promise<walletCoreApi.CoreApiResponse> {
     const wdb = this.globalTestState.testDir + "/walletdb.json";
     const resp = await sh(
+      this.globalTestState,
+      "wallet",
       `taler-wallet-cli --no-throttle --wallet-db '${wdb}' api '${request}' 
${shellWrap(
         JSON.stringify(payload),
       )}`,
@@ -926,12 +929,18 @@ export class WalletCli {
   async runUntilDone(): Promise<void> {
     const wdb = this.globalTestState.testDir + "/walletdb.json";
     await sh(
+      this.globalTestState,
+      "wallet",
       `taler-wallet-cli --no-throttle --wallet-db ${wdb} run-until-done`,
     );
   }
 
   async runPending(): Promise<void> {
     const wdb = this.globalTestState.testDir + "/walletdb.json";
-    await sh(`taler-wallet-cli --no-throttle --wallet-db ${wdb} run-pending`);
+    await sh(
+      this.globalTestState,
+      "wallet",
+      `taler-wallet-cli --no-throttle --wallet-db ${wdb} run-pending`,
+    );
   }
 }

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