]> git.ipfire.org Git - thirdparty/systemd.git/commit
test: fix flaky testcase_15_wait_online_dns in TEST-75-RESOLVED
authorLuca Boccassi <luca.boccassi@gmail.com>
Wed, 6 May 2026 17:04:51 +0000 (18:04 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Thu, 7 May 2026 12:36:00 +0000 (14:36 +0200)
commitd4bc62713e09df09281f26f4bf385801a3ee2897
tree2d31643173161740f3a59d82d84d97aa155e1f36
parent67e23e0e050fca0279fc6045de20ed05b0b97bee
test: fix flaky testcase_15_wait_online_dns in TEST-75-RESOLVED

The test used `timeout 30 bash -c "journalctl -b -u $unit -f | grep -m1 ..."`
to wait for systemd-networkd-wait-online to log that no DNS server is
accessible. The expected message is actually emitted ~1s after the unit
starts, but `grep -m1` exiting doesn't tear down `journalctl -f`: journalctl
only notices the closed pipe on its next write, which may never happen for
an otherwise idle unit. The pipeline therefore hangs until the 30s timeout
fires, eventually causing the test to fail.

Replace the follow+pipe with a polling `journalctl --grep` loop, which
exits cleanly as soon as the message lands in the journal.

Logs from the failing run:

  [ 2650.871441] systemd-networkd-wait-online[2190]: dns0: No DNS configuration yet
  [ 2651.723180] systemd-networkd-wait-online[2190]: dns0: No DNS server is accessible.
  [ 2680.909048] systemd-networkd-wait-online[2190]: json-stream: Got POLLHUP from socket.
  [ 2680.909092] systemd-networkd-wait-online[2190]: DNS configuration monitor disconnected, reconnecting...
  [ 2680.914368] systemd-networkd-wait-online[2190]: Failed to connect to io.systemd.Resolve.Monitor: Connection refused
  [ 2681.966674] systemd-networkd-wait-online[2190]: dns0: No DNS server is accessible.
  [ 2681.969527] systemd-networkd-wait-online[2190]: Failed to connect to io.systemd.Resolve.Monitor: Connection refused
  [ 2682.077032] systemd[1]: Stopping wait-online-dns-0f9e4f6d-8b34-4cff-b2da-03612ca731e8.service - [systemd-run] /usr/lib/systemd/systemd-networkd-wait-online --timeout=0 --dns --interface=dns0...

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
test/units/TEST-75-RESOLVED.sh