From 05575a104b9f40460232899b39f8fd5934147afa Mon Sep 17 00:00:00 2001 From: Dan Streetman Date: Mon, 24 May 2021 19:41:25 -0400 Subject: 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 --- test/networkd-test.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/networkd-test.py') 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') -- cgit v1.2.1