gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: Port checker.


From: gnunet
Subject: [libeufin] branch master updated: Port checker.
Date: Mon, 04 May 2020 18:08:17 +0200

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

marcello pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 8d6bf35  Port checker.
8d6bf35 is described below

commit 8d6bf35f45ff0e6a881301c5606dd3e06d619ee4
Author: Marcello Stanisci <address@hidden>
AuthorDate: Mon May 4 18:08:04 2020 +0200

    Port checker.
---
 integration-tests/test-ebics.py | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/integration-tests/test-ebics.py b/integration-tests/test-ebics.py
index fbec0fb..8b6cb75 100755
--- a/integration-tests/test-ebics.py
+++ b/integration-tests/test-ebics.py
@@ -4,6 +4,7 @@ from requests import post, get
 from subprocess import call, Popen, PIPE
 from time import sleep
 import os
+import socket
 
 # Steps implemented in this test.
 #
@@ -45,29 +46,42 @@ SUBSCRIBER_BIC="BUKBGB22"
 SUBSCRIBER_NAME="Oliver Smith"
 BANK_ACCOUNT_LABEL="savings"
 
+def checkPorts():
+    for i in [5000, 5001]:
+        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        try:
+            s.bind(i)
+            s.close()
+        except:
+            print("Port {} is not available")
+            exit(77)
+
 def assertResponse(response):
     if response.status_code != 200:
         print("Test failed on URL: {}".format(response.url))
         # stdout/stderr from both services is A LOT of text.
         # Confusing to dump all that to console.
-        print("Check nexus.log and sandbox.log under /tmp (?)")
+        print("Check nexus.log and sandbox.log, probably under /tmp")
         nexus.terminate()
         sandbox.terminate()
+        exit(1)
     # Allows for finer grained checks.
     return response
 
 #-1 Clean databases and start services.
-assert(0 == call(["rm", "-f", "../sandbox/libeufin-sandbox.sqlite3"]))
-assert(0 == call(["rm", "-f", "../nexus/libeufin-nexus.sqlite3"]))
+os.chdir("..")
+assert(0 == call(["rm", "-f", "sandbox/libeufin-sandbox.sqlite3"]))
+assert(0 == call(["rm", "-f", "nexus/libeufin-nexus.sqlite3"]))
 DEVNULL = open(os.devnull, "w")
 
 # Start nexus
-nexus = Popen(["../gradlew", "nexus:run"], stdout=PIPE, stderr=PIPE)
+nexus = Popen(["./gradlew", "nexus:run"], stdout=PIPE, stderr=PIPE)
 for i in range(10):
     try:
       get("http://localhost:5001/";)
     except:
         if i == 9:
+            nexus.terminate()
             stdout, stderr = nexus.communicate()
             print("{}\n{}".format(stdout.decode(), stderr.decode()))
             exit(77)
@@ -75,12 +89,14 @@ for i in range(10):
         continue
     break
 
-sandbox = Popen(["../gradlew", "sandbox:run"], stdout=PIPE, stderr=PIPE)
+sandbox = Popen(["./gradlew", "sandbox:run"], stdout=PIPE, stderr=PIPE)
 for i in range(10):
     try:
       get("http://localhost:5000/";)
     except:
         if i == 9:
+            nexus.terminate()
+            sandbox.terminate()
             stdout, stderr = nexus.communicate()
             print("{}\n{}".format(stdout.decode(), stderr.decode()))
             exit(77)
@@ -234,3 +250,5 @@ resp = assertResponse(
     )
 )
 assert(len(resp.json().get("payments")) == 1)
+
+print("Test passed!")

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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