]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: do not stop/restart udevd and related socket units
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 22 Jul 2022 01:24:09 +0000 (10:24 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 22 Jul 2022 01:31:38 +0000 (10:31 +0900)
That's not necessary. Moreover, if the socket units are stopped in
`setUpModule()`, then there exists a short timespan that we cannot call
`udevadm control`, as the control socket may not be opened yet.

If we run whole tests, then the first test is
NetworkctlTests.test_altname, and it calls `udevadm control` in `setUp()`.
Hence, the test may fail.

Fixes https://github.com/systemd/systemd-centos-ci/pull/512#issuecomment-1191591008.

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

index 6a3a2c6f459bd55b9e76ab6841991efdd1d423b4..6a32bad99fa53a339699958547f43804821a9425 100755 (executable)
@@ -341,8 +341,7 @@ def clear_udev_rules():
     rm_rf(udev_rules_dir)
 
 def save_active_units():
-    for u in ['systemd-udevd-kernel.socket', 'systemd-udevd-control.socket', 'systemd-udevd.service',
-              'systemd-networkd.socket', 'systemd-networkd.service',
+    for u in ['systemd-networkd.socket', 'systemd-networkd.service',
               'systemd-resolved.service',
               'firewalld.service']:
         if call(f'systemctl is-active --quiet {u}') == 0:
@@ -352,8 +351,6 @@ def save_active_units():
 def restore_active_units():
     if 'systemd-networkd.socket' in active_units:
         call('systemctl stop systemd-networkd.socket systemd-networkd.service')
-    if 'systemd-udevd-kernel.socket' in active_units or 'systemd-udevd-control.socket' in active_units:
-        call('systemctl stop systemd-udevd-kernel.socket systemd-udevd-control.socket systemd-udevd.service')
     for u in active_units:
         call(f'systemctl restart {u}')
 
@@ -730,6 +727,7 @@ def tearDownModule():
     rm_rf('/run/systemd/system/systemd-resolved.service.d')
     rm_rf('/run/systemd/system/systemd-udevd.service.d')
     check_output('systemctl daemon-reload')
+    check_output('systemctl restart systemd-udevd.service')
     restore_active_units()
 
 class Utilities():