test-network: replace check_link_exists() with wait_online()
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
[Match]
|
||||
Name=dummy98
|
||||
|
||||
[Network]
|
||||
IPv6AcceptRA=no
|
||||
|
||||
[Neighbor]
|
||||
Address=192.168.10.1
|
||||
MACAddress=00:00:5e:00:02:65
|
||||
|
||||
@@ -1142,7 +1142,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
|
||||
def test_nlmon(self):
|
||||
copy_unit_to_networkd_unit_path('25-nlmon.netdev', 'netdev-link-local-addressing-yes.network')
|
||||
start_networkd()
|
||||
start_networkd(0)
|
||||
|
||||
wait_online(['nlmon99:carrier'])
|
||||
|
||||
@@ -1322,9 +1322,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
|
||||
def test_configure_without_carrier(self):
|
||||
copy_unit_to_networkd_unit_path('configure-without-carrier.network', '11-dummy.netdev')
|
||||
start_networkd()
|
||||
|
||||
self.check_link_exists('test1')
|
||||
start_networkd(0)
|
||||
wait_online(['test1:routable'])
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'test1')
|
||||
print(output)
|
||||
@@ -1334,10 +1333,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
|
||||
def test_routing_policy_rule(self):
|
||||
copy_unit_to_networkd_unit_path('routing-policy-rule-test1.network', '11-dummy.netdev')
|
||||
|
||||
start_networkd()
|
||||
|
||||
self.check_link_exists('test1')
|
||||
start_networkd(0)
|
||||
wait_online(['test1:degraded'])
|
||||
|
||||
output = check_output('ip rule')
|
||||
print(output)
|
||||
@@ -1354,10 +1351,9 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
|
||||
for trial in range(3):
|
||||
# Remove state files only first time
|
||||
start_networkd(remove_state_files=(trial == 0))
|
||||
|
||||
self.check_link_exists('test1')
|
||||
self.check_link_exists('dummy98')
|
||||
start_networkd(0, remove_state_files=(trial == 0))
|
||||
wait_online(['test1:degraded', 'dummy98:degraded'])
|
||||
time.sleep(1)
|
||||
|
||||
output = check_output('ip rule list table 7')
|
||||
print(output)
|
||||
@@ -1370,10 +1366,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
@expectedFailureIfRoutingPolicyPortRangeIsNotAvailable()
|
||||
def test_routing_policy_rule_port_range(self):
|
||||
copy_unit_to_networkd_unit_path('25-fibrule-port-range.network', '11-dummy.netdev')
|
||||
|
||||
start_networkd()
|
||||
|
||||
self.check_link_exists('test1')
|
||||
start_networkd(0)
|
||||
wait_online(['test1:degraded'])
|
||||
|
||||
output = check_output('ip rule')
|
||||
print(output)
|
||||
@@ -1387,10 +1381,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
@expectedFailureIfRoutingPolicyIPProtoIsNotAvailable()
|
||||
def test_routing_policy_rule_invert(self):
|
||||
copy_unit_to_networkd_unit_path('25-fibrule-invert.network', '11-dummy.netdev')
|
||||
|
||||
start_networkd()
|
||||
|
||||
self.check_link_exists('test1')
|
||||
start_networkd(0)
|
||||
wait_online(['test1:degraded'])
|
||||
|
||||
output = check_output('ip rule')
|
||||
print(output)
|
||||
@@ -1402,7 +1394,6 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
def test_route_static(self):
|
||||
copy_unit_to_networkd_unit_path('25-route-static.network', '12-dummy.netdev')
|
||||
start_networkd(0)
|
||||
|
||||
wait_online(['dummy98:routable'])
|
||||
|
||||
output = check_output('ip -6 route show dev dummy98')
|
||||
@@ -1443,10 +1434,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
# reuse a bond from an earlier test, which does make the addresses go through
|
||||
# tentative state, and do our test on that
|
||||
copy_unit_to_networkd_unit_path('23-active-slave.network', '25-route-ipv6-src.network', '25-bond-active-backup-slave.netdev', '12-dummy.netdev')
|
||||
start_networkd()
|
||||
|
||||
self.check_link_exists('dummy98')
|
||||
self.check_link_exists('bond199')
|
||||
start_networkd(0)
|
||||
wait_online(['dummy98:enslaved', 'bond199:routable'])
|
||||
|
||||
output = check_output('ip -6 route list dev bond199')
|
||||
print(output)
|
||||
@@ -1456,9 +1445,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
|
||||
def test_ip_link_mac_address(self):
|
||||
copy_unit_to_networkd_unit_path('25-address-link-section.network', '12-dummy.netdev')
|
||||
start_networkd()
|
||||
|
||||
self.check_link_exists('dummy98')
|
||||
start_networkd(0)
|
||||
wait_online(['dummy98:degraded'])
|
||||
|
||||
output = check_output('ip link show dummy98')
|
||||
print(output)
|
||||
@@ -1466,19 +1454,16 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
|
||||
def test_ip_link_unmanaged(self):
|
||||
copy_unit_to_networkd_unit_path('25-link-section-unmanaged.network', '12-dummy.netdev')
|
||||
start_networkd()
|
||||
start_networkd(5)
|
||||
|
||||
self.check_link_exists('dummy98')
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'dummy98')
|
||||
print(output)
|
||||
self.assertRegex(output, 'unmanaged')
|
||||
self.check_operstate('dummy98', 'off', setup_state='unmanaged')
|
||||
|
||||
def test_ipv6_address_label(self):
|
||||
copy_unit_to_networkd_unit_path('25-ipv6-address-label-section.network', '12-dummy.netdev')
|
||||
start_networkd()
|
||||
|
||||
self.check_link_exists('dummy98')
|
||||
start_networkd(0)
|
||||
wait_online(['dummy98:degraded'])
|
||||
|
||||
output = check_output('ip addrlabel list')
|
||||
print(output)
|
||||
@@ -1486,11 +1471,10 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
|
||||
def test_ipv6_neighbor(self):
|
||||
copy_unit_to_networkd_unit_path('25-neighbor-section.network', '12-dummy.netdev')
|
||||
start_networkd()
|
||||
start_networkd(0)
|
||||
wait_online(['dummy98:degraded'], timeout='40s')
|
||||
|
||||
self.check_link_exists('dummy98')
|
||||
|
||||
output = check_output('ip neigh list')
|
||||
output = check_output('ip neigh list dev dummy98')
|
||||
print(output)
|
||||
self.assertRegex(output, '192.168.10.1.*00:00:5e:00:02:65.*PERMANENT')
|
||||
self.assertRegex(output, '2004:da8:1::1.*00:00:5e:00:02:66.*PERMANENT')
|
||||
@@ -1610,9 +1594,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
|
||||
def test_bind_carrier(self):
|
||||
copy_unit_to_networkd_unit_path('25-bind-carrier.network', '11-dummy.netdev')
|
||||
start_networkd()
|
||||
|
||||
self.check_link_exists('test1')
|
||||
start_networkd(0)
|
||||
wait_online(['test1:routable'])
|
||||
|
||||
check_output('ip link add dummy98 type dummy')
|
||||
check_output('ip link set dummy98 up')
|
||||
|
||||
Reference in New Issue
Block a user