All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 05/13] auto-t: fixup testRoamRetry for better timing reliability
@ 2022-03-28 17:28 James Prestwood
  0 siblings, 0 replies; only message in thread
From: James Prestwood @ 2022-03-28 17:28 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 4468 bytes --]

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.
---
 autotests/testRoamRetry/fast_retry_test.py | 13 ++++++-------
 autotests/testRoamRetry/stop_retry_test.py |  7 +++----
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/autotests/testRoamRetry/fast_retry_test.py b/autotests/testRoamRetry/fast_retry_test.py
index c7de5055..b45daada 100644
--- 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
index f2f95990..3957d12d 100644
--- 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
-- 
2.34.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-28 17:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 17:28 [PATCH v4 05/13] auto-t: fixup testRoamRetry for better timing reliability James Prestwood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.