]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: handle the case where dnsmasq is slow to start better 41067/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 13 Mar 2026 11:02:07 +0000 (12:02 +0100)
committerGitHub <noreply@github.com>
Fri, 13 Mar 2026 11:02:07 +0000 (12:02 +0100)
> 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

index 8aee898aab3d025176f8565a86f1d3114857d4c5..bab725bd23943ff81c2d9c31ebecdb10f1ce097b 100755 (executable)
@@ -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