From f0d87798eaed167daf5a21e07ec8dc821f07ec19 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 26 Jan 2021 21:06:36 +0900 Subject: [PATCH] test-network: retry several times if expected LLDP info is not obtained As LLDP thing does not get involved in the link status, `networkctl lldp` may not provide an expected information even if the link is in 'configured' state. Fixes #17360. --- test/test-network/systemd-networkd-tests.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index ecd3eaf8f9..ab43bf30d6 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -3429,10 +3429,16 @@ class NetworkdLLDPTests(unittest.TestCase, Utilities): start_networkd() self.wait_online(['veth99:degraded', 'veth-peer:degraded']) - output = check_output(*networkctl_cmd, 'lldp', env=env) - print(output) - self.assertRegex(output, 'veth-peer') - self.assertRegex(output, 'veth99') + for trial in range(10): + if trial > 0: + time.sleep(1) + + output = check_output(*networkctl_cmd, 'lldp', env=env) + print(output) + if re.search(r'veth99 .* veth-peer', output): + break + else: + self.fail() class NetworkdRATests(unittest.TestCase, Utilities): links = ['veth99']