From a649bd2148d98f00198ff22882bb6637a048f745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Mon, 27 Jun 2022 22:50:00 +0200 Subject: [PATCH] Also test DNS-over-TLS code using sslyze Since sslyze can test any TLS-enabled server, also use it for exercising DNS-over-TLS code rather than just DNS-over-HTTPS code. (cherry picked from commit 4f128927409645dce2f0ed0662aec18bbb10fc75) --- bin/tests/system/doth/tests_sslyze.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bin/tests/system/doth/tests_sslyze.py b/bin/tests/system/doth/tests_sslyze.py index 2a19e28b26..2562fe482d 100644 --- a/bin/tests/system/doth/tests_sslyze.py +++ b/bin/tests/system/doth/tests_sslyze.py @@ -26,7 +26,7 @@ def is_pid_alive(pid): return False -def test_sslyze_doh(sslyze_executable, named_httpsport): +def run_sslyze_in_a_loop(executable, port, log_file_prefix): # Determine the PID of ns1. with open(pathlib.Path("ns1", "named.pid"), encoding="utf-8") as pidfile: pid = int(pidfile.read()) @@ -39,9 +39,9 @@ def test_sslyze_doh(sslyze_executable, named_httpsport): # Run sslyze on ns1 in a loop with a limit of 30 iterations. Interrupt the # test as soon as ns1 is determined to not be running any more. Log sslyze # output. - sslyze_args = [sslyze_executable, f"10.53.0.1:{named_httpsport}"] + sslyze_args = [executable, f"10.53.0.1:{port}"] for i in range(0, 30): - log_file = f"sslyze.log.doh.ns1.{named_httpsport}.{i + 1}" + log_file = f"{log_file_prefix}.ns1.{port}.{i + 1}" with open(log_file, "wb") as sslyze_log: # Run sslyze, logging stdout+stderr. Ignore the exit code since # sslyze is only used for triggering crashes here rather than @@ -55,3 +55,11 @@ def test_sslyze_doh(sslyze_executable, named_httpsport): ) # Ensure ns1 is still alive after each sslyze run. assert is_pid_alive(pid), f"ns1 (PID: {pid}) exited prematurely" + + +def test_sslyze_doh(sslyze_executable, named_httpsport): + run_sslyze_in_a_loop(sslyze_executable, named_httpsport, "sslyze.log.doh") + + +def test_sslyze_dot(sslyze_executable, named_tlsport): + run_sslyze_in_a_loop(sslyze_executable, named_tlsport, "sslyze.log.dot")