]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd-test.py: hide default .network files
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 8 Nov 2023 16:58:30 +0000 (01:58 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 8 Nov 2023 22:16:56 +0000 (07:16 +0900)
To make the test works fine with -Ddefault-network=True.

test/networkd-test.py

index bf07bea17c8a1c400e85fe6035e6bacb47a3b7fe..9d8403d91d8627d0c70232caa2daa81ee351012e 100755 (executable)
@@ -87,6 +87,12 @@ def setUpModule():
     # Ensure the unit directory exists so tests can dump files into it.
     os.makedirs(NETWORK_UNITDIR, exist_ok=True)
 
+    # mask all default .network files
+    if os.path.exists('/usr/lib/systemd/network'):
+        for unit in os.listdir('/usr/lib/systemd/network'):
+            if unit.endswith('.network'):
+                os.symlink('/dev/null', os.path.join(NETWORK_UNITDIR, unit))
+
 
 def tearDownModule():
     global tmpmounts