From e799263ff4160565953ac6b52be3706d91133bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 13 Mar 2026 12:02:07 +0100 Subject: [PATCH] test-network: handle the case where dnsmasq is slow to start better MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > read_dnsmasq_log_file() will raise FileNotFoundError if dnsmasq hasn’t created the > log file yet (or if the file was just removed by stop_dnsmasq() before the restart). > This would error the test instead of retrying. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- test/test-network/systemd-networkd-tests.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 8aee898aab..bab725bd23 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -8023,7 +8023,10 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities): success = False for _ in range(20): time.sleep(0.5) - output = read_dnsmasq_log_file() + try: + output = read_dnsmasq_log_file() + except FileNotFoundError: + output = "" if 'DHCPRELEASE' in output: success = True break