aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-11-28 20:03:56 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-11-28 21:40:57 +0100
commitbad4969bbad8303139c486c0a8be854f73e2749a (patch)
tree6e4e7922f43d2aee749ca2d96a95f5012a34f066 /test/test-network
parenttest-network: use /run instead of legacy /var/run (diff)
downloadsystemd-bad4969bbad8303139c486c0a8be854f73e2749a.tar.gz
systemd-bad4969bbad8303139c486c0a8be854f73e2749a.tar.bz2
systemd-bad4969bbad8303139c486c0a8be854f73e2749a.zip
test-network: clear state file before starting networkd
Otherwise, some tests may disturb others, e.g., NetworkdNetWorkTests.test_routing_policy_rule_port_range and NetworkdNetWorkTests.test_routing_policy_rule.
Diffstat (limited to 'test/test-network')
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 37a022922..52823dc74 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -15,6 +15,7 @@ import threading
from shutil import copytree
network_unit_file_path='/run/systemd/network'
+networkd_runtime_directory='/run/systemd/netif'
networkd_ci_path='/run/networkd-ci'
network_sysctl_ipv6_path='/proc/sys/net/ipv6/conf'
network_sysctl_ipv4_path='/proc/sys/net/ipv4/conf'
@@ -118,7 +119,12 @@ class Utilities():
os.remove(dnsmasq_log_file)
def start_networkd(self):
- subprocess.check_call('systemctl restart systemd-networkd', shell=True)
+ if (os.path.exists(os.path.join(networkd_runtime_directory, 'state'))):
+ subprocess.check_call('systemctl stop systemd-networkd', shell=True)
+ os.remove(os.path.join(networkd_runtime_directory, 'state'))
+ subprocess.check_call('systemctl start systemd-networkd', shell=True)
+ else:
+ subprocess.check_call('systemctl restart systemd-networkd', shell=True)
time.sleep(5)
global ip