Changeset: 676010558b3a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/676010558b3a
Modified Files:
        clients/mapilib/Tests/systemcertificates.py
        clients/mapilib/Tests/tlssecurity.py
Branch: monetdburl
Log Message:

In tls tests, show stderr when mclient doesn't exit with code 2.

(For example if LeakSanitizer triggers)


diffs (30 lines):

diff --git a/clients/mapilib/Tests/systemcertificates.py 
b/clients/mapilib/Tests/systemcertificates.py
--- a/clients/mapilib/Tests/systemcertificates.py
+++ b/clients/mapilib/Tests/systemcertificates.py
@@ -25,7 +25,10 @@ HOST = 'python.org'
 # Run mclient
 cmd = ['mclient', '-L-', '-d', f"monetdbs://{HOST}:443/demo"]
 proc = subprocess.run(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
-assert proc.returncode == 2, f"mclient is supposed to exit with status 2, not 
{proc.returncode}"
+if proc.returncode != 2:
+    msg = str(proc.stderr, 'utf-8')
+    print(f"mclient is supposed to exit with status 2, not 
{proc.returncode}.\n--- stderr ---\n{msg}\n---end stderr ---", file=sys.stderr)
+    exit(1)
 
 # After the TLS handshake succeeds we expect the server to send something like
 # 'HTTP/1.1 400 Bad Request' because we're sending \x00\x00 instead of an HTTP
diff --git a/clients/mapilib/Tests/tlssecurity.py 
b/clients/mapilib/Tests/tlssecurity.py
--- a/clients/mapilib/Tests/tlssecurity.py
+++ b/clients/mapilib/Tests/tlssecurity.py
@@ -75,7 +75,10 @@ def attempt(experiment: str, portname: s
     logging.debug(f"cmd={cmd}")
     proc = subprocess.run(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
     logging.debug(f"mclient exited with code {proc.returncode}, 
err={proc.stderr}")
-    assert proc.returncode == 2, f"mclient is supposed to exit with status 2, 
not {proc.returncode}"
+    if proc.returncode != 2:
+        msg = str(proc.stderr, 'utf-8')
+        print(f"mclient is supposed to exit with status 2, not 
{proc.returncode}.\n--- stderr ---\n{msg}\n---end stderr ---", file=sys.stderr)
+        assert proc.returncode == 2, f"mclient is supposed to exit with status 
2, not {proc.returncode}"
     output = str(proc.stderr, 'utf-8').rstrip()
     actual_error = None if 'Sorry, this is not' in output else output
 
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to