From: Dan Streetman Date: Mon, 24 May 2021 23:41:25 +0000 (-0400) Subject: test/networkd-test: in bridge test, wait for online after restart systemd-networkd X-Git-Tag: v249-rc1~132 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=05575a104b9f40460232899b39f8fd5934147afa;p=thirdparty%2Fsystemd.git 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 --- diff --git a/test/networkd-test.py b/test/networkd-test.py index c13a20dd7f0..799df0877ff 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')