]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: also save the current state of socket units for resolved and stop them
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 8 Aug 2025 01:06:22 +0000 (10:06 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 8 Aug 2025 10:38:27 +0000 (19:38 +0900)
Silence the following waring:
```
Stopping 'systemd-resolved.service', but its triggering units are still active:
systemd-resolved-varlink.socket, systemd-resolved-monitor.socket
```

Follow-up for 0fa188307b1c286e7b86201b1cfb91014b970092.

test/test-network/systemd-networkd-tests.py

index 0ea0f03b77fe4a7d2714d1729f2457faa4dd3301..b650b34f98727bf30478d332244f46fa4e3d0834 100755 (executable)
@@ -427,6 +427,8 @@ def save_active_units():
             'systemd-networkd.socket',
             'systemd-networkd-varlink.socket',
             'systemd-networkd.service',
+            'systemd-resolved-monitor.socket',
+            'systemd-resolved-varlink.socket',
             'systemd-resolved.service',
             'systemd-timesyncd.service',
             'firewalld.service'
@@ -436,19 +438,31 @@ def save_active_units():
             active_units.append(u)
 
 def restore_active_units():
-    has_socket = False
+    has_network_socket = False
+    has_resolve_socket = False
 
     if 'systemd-networkd.socket' in active_units:
         call('systemctl stop systemd-networkd.socket')
-        has_socket = True
+        has_network_socket = True
 
     if 'systemd-networkd-varlink.socket' in active_units:
         call('systemctl stop systemd-networkd-varlink.socket')
-        has_socket = True
+        has_network_socket = True
 
-    if has_socket:
+    if 'systemd-resolved-monitor.socket' in active_units:
+        call('systemctl stop systemd-resolved-monitor.socket')
+        has_resolve_socket = True
+
+    if 'systemd-resolved-varlink.socket' in active_units:
+        call('systemctl stop systemd-resolved-varlink.socket')
+        has_resolve_socket = True
+
+    if has_network_socket:
         call('systemctl stop systemd-networkd.service')
 
+    if has_resolve_socket:
+        call('systemctl stop systemd-resolved.service')
+
     for u in active_units:
         call(f'systemctl restart {u}')