From 93b4b110a756e44d22bee7e19658811607a34c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Thu, 21 Dec 2023 12:22:18 +0100 Subject: [PATCH] Refactor string matching loop for readability (cherry picked from commit 831c5d34f96441fa9aa258feab26e452333cc3ff) --- bin/tests/system/checkds/tests_checkds.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bin/tests/system/checkds/tests_checkds.py b/bin/tests/system/checkds/tests_checkds.py index 01c34de132..b6fcaa15d8 100755 --- a/bin/tests/system/checkds/tests_checkds.py +++ b/bin/tests/system/checkds/tests_checkds.py @@ -356,12 +356,15 @@ def test_checkds(servers, params): # Wait until the provided zone is signed and then verify its DNSSEC data. zone_check(servers["ns9"], params.zone) - # Wait until all the expected log lines are found in the log file for the - # provided server. + # Wait up to 10 seconds until all the expected log lines are found in the + # log file for the provided server. + time_remaining = 10 for log_string in params.logs_to_wait_for: - with servers["ns9"].watch_log_from_start() as watcher: - line = f"zone {params.zone}/IN (signed): checkds: {log_string}" - watcher.wait_for_line(line) + line = f"zone {params.zone}/IN (signed): checkds: {log_string}" + while line not in servers["ns9"].log: + time_remaining -= 1 + assert time_remaining, f'Timed out waiting for "{log_string}" to be logged' + time.sleep(1) # Check whether key states on the parent server provided match # expectations.