commit f1a7e23eea30ecb40b5608356486fe61eac7e0b7
parent 6e608b14f5bc69b8a2ec9b9a0e3d12389ba916d2
Author: James Prestwood <prestwoj@gmail.com>
Date: Mon, 28 Mar 2022 10:28:34 -0700
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.
Diffstat:
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/autotests/testRoamRetry/fast_retry_test.py b/autotests/testRoamRetry/fast_retry_test.py
@@ -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()
diff --git a/autotests/testRoamRetry/stop_retry_test.py b/autotests/testRoamRetry/stop_retry_test.py
@@ -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