]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-07-PID1: wait for systemd-resolved being stopped
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 28 Oct 2025 04:20:58 +0000 (13:20 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 28 Oct 2025 13:26:15 +0000 (13:26 +0000)
As 'systemctl stop' is called with --no-block, previously systemd-resolved
might not be stopped when 'resolvectl' is called, and the DBus connection
might be closed during the call:
```
TEST-07-PID1.sh[5643]: + systemctl stop --no-block systemd-resolved.service
TEST-07-PID1.sh[5643]: + resolvectl
TEST-07-PID1.sh[5732]: Failed to get global data: Remote peer disconnected
```

Follow-up for 8eefd0f4debc0bcfeea89dd39c43e3318f3f7ae7.
Fixes https://github.com/systemd/systemd/pull/39388#issuecomment-3439277442.

test/units/TEST-07-PID1.start-limit.sh

index ed9f4b37c19f232e2862c3525ebd4caa87f3071a..93447452dae013a10ed01fd9419638d1863d6b9f 100755 (executable)
@@ -35,6 +35,9 @@ for i in {1..5}; do
     echo "Start #$i"
 
     systemctl stop --no-block systemd-resolved.service
+    # Wait for systemd-resolved in ExecStart= being stopped.
+    # shellcheck disable=SC2016
+    timeout 10 bash -c 'until [[ "$(systemctl show --property=MainPID --value systemd-resolved.service)" == 0 ]]; do sleep 0.1; done'
     if ! resolvectl; then
         journalctl -o short-monotonic --no-hostname --no-pager -u systemd-resolved.service -n 15
         exit 1