]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: retry several times if expected LLDP info is not obtained
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 26 Jan 2021 12:06:36 +0000 (21:06 +0900)
committerLennart Poettering <lennart@poettering.net>
Tue, 26 Jan 2021 17:48:44 +0000 (18:48 +0100)
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

index ecd3eaf8f9b573a743f4f8387c3d98f5f84f7cf9..ab43bf30d6e62b2a3a9e9cac8e1a737993d95458 100755 (executable)
@@ -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']