summaryrefslogtreecommitdiff
path: root/test/networkd-test.py
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@canonical.com>2021-05-24 19:41:25 -0400
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-05-28 12:26:33 +0900
commit05575a104b9f40460232899b39f8fd5934147afa (patch)
tree4b3ee0ad2cef3e45d8a48ce981665ecb7929b7ad /test/networkd-test.py
parentb2d74870711f859ddc72c5756299d2c2f1659468 (diff)
downloadsystemd-05575a104b9f40460232899b39f8fd5934147afa.tar.gz
test/networkd-test: in bridge test, wait for online after restart systemd-networkd
without waiting for online, there is a race condition between systemd-networkd actually setting the new values and the test checking those values This also sets the link down before restarting systemd-networkd, to avoid the wait for online being a no-op
Diffstat (limited to 'test/networkd-test.py')
-rwxr-xr-xtest/networkd-test.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/networkd-test.py b/test/networkd-test.py
index c13a20dd7f..799df0877f 100755
--- a/test/networkd-test.py
+++ b/test/networkd-test.py
@@ -247,7 +247,10 @@ Gateway=192.168.250.1
[Bridge]
Priority=28
''')
+ subprocess.check_call(['ip', 'link', 'set', 'dev', 'port1', 'down'])
subprocess.check_call(['systemctl', 'restart', 'systemd-networkd'])
+ subprocess.check_call([NETWORKD_WAIT_ONLINE, '--interface',
+ 'port1', '--timeout=5'])
self.assertEqual(self.read_attr('port1', 'brport/priority'), '28')
def test_bridge_port_priority_set_zero(self):
@@ -257,7 +260,10 @@ Priority=28
[Bridge]
Priority=0
''')
+ subprocess.check_call(['ip', 'link', 'set', 'dev', 'port2', 'down'])
subprocess.check_call(['systemctl', 'restart', 'systemd-networkd'])
+ subprocess.check_call([NETWORKD_WAIT_ONLINE, '--interface',
+ 'port2', '--timeout=5'])
self.assertEqual(self.read_attr('port2', 'brport/priority'), '0')
def test_bridge_port_property(self):
@@ -273,7 +279,10 @@ AllowPortToBeRoot=true
Cost=555
Priority=23
''')
+ subprocess.check_call(['ip', 'link', 'set', 'dev', 'port2', 'down'])
subprocess.check_call(['systemctl', 'restart', 'systemd-networkd'])
+ subprocess.check_call([NETWORKD_WAIT_ONLINE, '--interface',
+ 'port2', '--timeout=5'])
self.assertEqual(self.read_attr('port2', 'brport/priority'), '23')
self.assertEqual(self.read_attr('port2', 'brport/hairpin_mode'), '1')