3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-26 01:02:35 +01:00

auto-t: fixup testRoamRetry for better timing reliability

Change a few critical checks that were failing sometimes:
 - A few asserts were changed to wait_for_object_condition
 - A 15 second timeout was removed (default used instead)
 - Do a full scan at beginning of each test to clear any
   cached BSS's. The second test run was getting stale results
   and the RSSI values were not expected.
This commit is contained in:
James Prestwood 2022-03-28 10:28:34 -07:00 committed by Denis Kenzior
parent 6e608b14f5
commit f1a7e23eea
2 changed files with 9 additions and 11 deletions

View File

@ -63,7 +63,7 @@ class Test(unittest.TestCase):
devices = wd.list_devices(1)
device = devices[0]
ordered_network = device.get_ordered_network('TestRoamRetry')
ordered_network = device.get_ordered_network('TestRoamRetry', full_scan=True)
self.assertEqual(ordered_network.type, NetworkType.psk)
@ -75,18 +75,18 @@ class Test(unittest.TestCase):
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
self.assertTrue(bss_hostapd[0].list_sta())
self.assertFalse(bss_hostapd[1].list_sta())
bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
wd.wait(5)
# Now push the signal LOW, wait for iwd to attempt a roam, fail, and
# schedule another attempt for 60 seconds later
# schedule another attempt
rule0.signal = -8000
device.wait_for_event('no-roam-candidates')
self.assertEqual(device.state, iwd.DeviceState.connected)
self.assertTrue(bss_hostapd[0].list_sta())
self.assertFalse(bss_hostapd[1].list_sta())
@ -101,12 +101,11 @@ class Test(unittest.TestCase):
wd.wait(1)
# Assert low signal for BSS 0, check that iwd starts transition to BSS 1
# in less than 10 seconds.
rule0.signal = -8000
rule1.signal = -2000
condition = 'obj.state == DeviceState.roaming'
wd.wait_for_object_condition(device, condition, max_wait=15)
wd.wait_for_object_condition(device, condition)
# Check that iwd is on BSS 1 once out of roaming state and doesn't
# go through 'disconnected', 'autoconnect', 'connecting' in between
@ -114,7 +113,7 @@ class Test(unittest.TestCase):
to_condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_change(device, from_condition, to_condition)
self.assertTrue(bss_hostapd[1].list_sta())
bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % device.address)
device.disconnect()

View File

@ -62,7 +62,7 @@ class Test(unittest.TestCase):
devices = wd.list_devices(1)
device = devices[0]
ordered_network = device.get_ordered_network('TestRoamRetry')
ordered_network = device.get_ordered_network('TestRoamRetry', full_scan=True)
self.assertEqual(ordered_network.type, NetworkType.psk)
@ -74,8 +74,7 @@ class Test(unittest.TestCase):
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
self.assertTrue(bss_hostapd[0].list_sta())
self.assertFalse(bss_hostapd[1].list_sta())
bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
# Now push the signal below the RSSI threshold and check that iwd
# connects to BSS 1
@ -90,7 +89,7 @@ class Test(unittest.TestCase):
to_condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_change(device, from_condition, to_condition)
self.assertTrue(bss_hostapd[1].list_sta())
bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % device.address)
# Now make sure that we don't roam anymore. In order to catch this via
# DeviceState, a suitable roaming target needs to be available. So jack