test-network: handle the case where dnsmasq is slow to start better

> 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>
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-03-13 12:02:07 +01:00
committed by GitHub
co-authored by Copilot Autofix powered by AI
parent 8e764acf1e
commit e799263ff4
+4 -1
View File
@@ -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