gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: improve test shutdown on erro


From: gnunet
Subject: [taler-wallet-core] branch master updated: improve test shutdown on errors
Date: Thu, 06 Aug 2020 14:46:10 +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 ecf76312 improve test shutdown on errors
ecf76312 is described below

commit ecf763126e858a7878b078fa94f96cee18b5900d
Author: Florian Dold <florian.dold@gmail.com>
AuthorDate: Thu Aug 6 18:16:04 2020 +0530

    improve test shutdown on errors
---
 packages/taler-integrationtests/src/harness.ts | 40 ++++++++++++++------------
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/packages/taler-integrationtests/src/harness.ts 
b/packages/taler-integrationtests/src/harness.ts
index 21ab51eb..17a21232 100644
--- a/packages/taler-integrationtests/src/harness.ts
+++ b/packages/taler-integrationtests/src/harness.ts
@@ -869,33 +869,37 @@ export interface MerchantInstanceConfig {
   defaultPayDelay?: time.Duration;
 }
 
+function shouldLinger(): boolean {
+  return process.env["TALER_TEST_KEEP"] == "1";
+}
+
 export function runTest(testMain: (gc: GlobalTestState) => Promise<void>) {
   const main = async () => {
-    const gc = new GlobalTestState({
-      testDir: await makeTempDir(),
-    });
+    let gc: GlobalTestState | undefined;
+    let ret = 0;
     try {
+      gc = new GlobalTestState({
+        testDir: await makeTempDir(),
+      });
       await testMain(gc);
+    } catch (e) {
+      console.error("FATAL: test failed with exception", e);
+      ret = 1;
     } finally {
-      await gc.terminate();
-      if (process.env["TALER_TEST_KEEP"] !== "1") {
-        console.log("test logs and config can be found under", gc.testDir);
+      if (gc) {
+        if (shouldLinger()) {
+          console.log("test logs and config can be found under", gc.testDir);
+          console.log("keeping test environment running");
+        } else {
+          await gc.terminate();
+          console.log("test logs and config can be found under", gc.testDir);
+          process.exit(ret);
+        }
       }
     }
   };
 
-  main().catch((e) => {
-    console.error("FATAL: test failed with exception");
-    if (e instanceof Error) {
-      console.error(e);
-    } else {
-      console.error(e);
-    }
-
-    if (process.env["TALER_TEST_KEEP"] !== "1") {
-      process.exit(1);
-    }
-  });
+  main();
 }
 
 function shellWrap(s: string) {

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