1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-11 05:17:44 +03:00

test-network: do not stop/restart udevd and related socket units

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.
This commit is contained in:
Yu Watanabe 2022-07-22 10:24:09 +09:00
parent 8d0c34f367
commit 87b308c825

View File

@ -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():