]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: wait for bridge slave to be enslaved in test_bridge_ignore_carrier_loss...
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 20 May 2019 13:40:54 +0000 (22:40 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 22 May 2019 08:59:39 +0000 (17:59 +0900)
test/test-network/systemd-networkd-tests.py

index 63d5cfd98ee012ef888fde00610f16cd47ef2447..6787fdc29b502c7c61faef9cf1caf94da67e9801 100755 (executable)
@@ -1777,15 +1777,18 @@ class NetworkdNetWorkBridgeTests(unittest.TestCase, Utilities):
         self.assertEqual(subprocess.call(['ip', 'link', 'add', 'dummy98', 'type', 'dummy']), 0)
         self.assertEqual(subprocess.call(['ip', 'link', 'set', 'dummy98', 'up']), 0)
 
-        time.sleep(3)
+        for trial in range(30):
+            if trial > 0:
+                time.sleep(1)
+            if self.get_operstate('bridge99') == 'routable' and self.get_operstate('dummy98') == 'enslaved':
+                break
+        else:
+            self.assertTrue(False)
 
         output = subprocess.check_output(['ip', 'address', 'show', 'bridge99'], universal_newlines=True).rstrip()
         print(output)
         self.assertRegex(output, 'inet 192.168.0.15/24 brd 192.168.0.255 scope global bridge99')
 
-        self.check_operstate('bridge99', 'routable')
-        self.check_operstate('dummy98', 'enslaved')
-
         output = subprocess.check_output(['ip', 'rule', 'list', 'table', '100'], universal_newlines=True).rstrip()
         print(output)
         self.assertEqual(output, '0:   from all to 8.8.8.8 lookup 100')