test-network: wait for bond interface to be no-carrier operational state

This commit is contained in:
Yu Watanabe 2019-05-15 18:46:41 +09:00
parent ce87a19087
commit 2700d2c7dc
1 changed files with 14 additions and 2 deletions

View File

@ -1566,11 +1566,23 @@ class NetworkdNetWorkBondTests(unittest.TestCase, Utilities):
self.assertEqual(subprocess.call(['ip', 'link', 'set', 'dummy98', 'down']), 0)
self.assertEqual(subprocess.call(['ip', 'link', 'set', 'test1', 'down']), 0)
time.sleep(5)
time.sleep(2)
self.check_operstate('dummy98', 'off')
self.check_operstate('test1', 'off')
self.check_operstate('bond99', 'no-carrier')
bond_has_no_carrier=False
for trial in range(30):
if trial > 0:
time.sleep(1)
output = subprocess.check_output(['ip', 'address', 'show', 'bond99'], universal_newlines=True).rstrip()
print(output)
if self.get_operstate('bond99') == 'no-carrier':
break
else:
# Huh? Kernel does not recognize that all slave interfaces are down?
# Let's confirm that networkd's operstate is consistent with ip's result.
self.assertNotRegex(output, 'NO-CARRIER')
class NetworkdNetWorkBridgeTests(unittest.TestCase, Utilities):
links = [