All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 06/13] auto-t: use wait_for_event in testBSSBlacklist
@ 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: 3894 bytes --]

Depending on timing hostapd may not show a station with list_sta().
Instead use wait_for_event.
---
 autotests/testBSSBlacklist/connection_test.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/autotests/testBSSBlacklist/connection_test.py b/autotests/testBSSBlacklist/connection_test.py
index 6a12174d..df3bd507 100644
--- a/autotests/testBSSBlacklist/connection_test.py
+++ b/autotests/testBSSBlacklist/connection_test.py
@@ -33,7 +33,7 @@ class Test(unittest.TestCase):
 
         dev1, dev2 = wd.list_devices(2)
 
-        ordered_network = dev1.get_ordered_network("TestBlacklist")
+        ordered_network = dev1.get_ordered_network("TestBlacklist", full_scan=True)
 
         self.assertEqual(ordered_network.type, NetworkType.psk)
 
@@ -45,12 +45,12 @@ class Test(unittest.TestCase):
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(dev1, condition)
 
-        self.assertIn(dev1.address, bss_hostapd[2].list_sta())
+        bss_hostapd[2].wait_for_event('AP-STA-CONNECTED %s' % dev1.address)
 
         # dev1 now connected, this should max out the first AP, causing the next
         # connection to fail to this AP.
 
-        ordered_network = dev2.get_ordered_network("TestBlacklist")
+        ordered_network = dev2.get_ordered_network("TestBlacklist", full_scan=True)
 
         self.assertEqual(ordered_network.type, NetworkType.psk)
 
@@ -64,7 +64,7 @@ class Test(unittest.TestCase):
 
         # We should have temporarily blacklisted the first BSS, and connected
         # to this one.
-        self.assertIn(dev2.address, bss_hostapd[1].list_sta())
+        bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % dev2.address)
 
         # Now check that the first BSS is still not blacklisted. We can
         # disconnect dev1, opening up the AP for more connections
@@ -83,7 +83,7 @@ class Test(unittest.TestCase):
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(dev2, condition)
 
-        self.assertIn(dev2.address, bss_hostapd[2].list_sta())
+        bss_hostapd[2].wait_for_event('AP-STA-CONNECTED %s' % dev2.address)
 
         wd.unregister_psk_agent(psk_agent)
 
@@ -134,7 +134,7 @@ class Test(unittest.TestCase):
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
 
-        self.assertIn(device.address, bss_hostapd[0].list_sta())
+        bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
 
         wd.unregister_psk_agent(psk_agent)
 
@@ -214,7 +214,7 @@ class Test(unittest.TestCase):
         # should automatically try the next BSS in the list, which is
         # bss_hostapd[1]
         self.assertNotIn(device.address, bss_hostapd[0].list_sta())
-        self.assertIn(device.address, bss_hostapd[1].list_sta())
+        bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % device.address)
 
         rule0.drop = False
 
@@ -234,7 +234,7 @@ class Test(unittest.TestCase):
 
         # Same as before, make sure we didn't connect to the blacklisted AP.
         self.assertNotIn(device.address, bss_hostapd[0].list_sta())
-        self.assertIn(device.address, bss_hostapd[1].list_sta())
+        bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % device.address)
 
         # Wait for the blacklist to expire (10 seconds)
         elapsed = time.time() - start
@@ -264,7 +264,7 @@ class Test(unittest.TestCase):
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
 
-        self.assertIn(device.address, bss_hostapd[0].list_sta())
+        bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
 
         self.wd.unregister_psk_agent(psk_agent)
 
-- 
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 06/13] auto-t: use wait_for_event in testBSSBlacklist 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.