]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: try to stop test-modem-manager-mock.service only when necessary
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 20 May 2026 14:40:51 +0000 (23:40 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 20 May 2026 22:10:50 +0000 (07:10 +0900)
Otherwise, all test cases that does not create/start the service emits
the following error:
```
Failed to stop test-modem-manager-mock.service: Unit test-modem-manager-mock.service not loaded.
```

Moreover, without this change, extra 'systemctl daemon-reload' is triggered after
all test cases. That's super heavy, especially when the test is running on
sanitizers.

Follow-up for abe3d570f8006fca5138b2d5cfb4e8b530be02e5.

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

index 9a8b38a88fa89fd5dec6d913bac34a01c2aa5872..877075ec5cd392cb5af0ddf7e4ba98c99dbba8f3 100755 (executable)
@@ -1210,7 +1210,6 @@ def tear_down_common():
     stop_dnsmasq()
     stop_isc_dhcpd()
     stop_radvd()
-    stop_modem_manager_mock()
 
     # 2. remove modules
     call_quiet('rmmod netdevsim')
@@ -10884,6 +10883,7 @@ class NetworkdWWANTests(unittest.TestCase, Utilities):
         setup_common()
 
     def tearDown(self):
+        stop_modem_manager_mock()
         tear_down_common()
 
     def test_wwan_ipv4v6_static(self):