commit fa366c79e466a6478f50ae243ddee44c278c57d2
parent 416ad05ce7e98895e024c8d0a8778644bc87d258
Author: James Prestwood <prestwoj@gmail.com>
Date: Wed, 30 Mar 2022 13:23:15 -0700
auto-t: test-wide replacement of assertTrue(list_sta())
Any test using assertTrue(hostapd.list_sta()) improperly has been
replaced with wait_for_event(). There were a few places where this
was actually ok (i.e. IWD is already connected) but most needed to
be changed since the check was just after IWD connected and hostapd's
list_sta() API may not return a fully updated list.
Diffstat:
5 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/autotests/testAPRoam/connection_test.py b/autotests/testAPRoam/connection_test.py
@@ -36,7 +36,6 @@ class Test(unittest.TestCase):
bss_hostapd[0].wait_for_event('AP-STA-CONNECTED')
- self.assertTrue(bss_hostapd[0].list_sta())
self.assertFalse(bss_hostapd[1].list_sta())
bss_hostapd[0].send_bss_transition(device.address,
@@ -51,8 +50,8 @@ class Test(unittest.TestCase):
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
- self.assertEqual(device.state, iwd.DeviceState.connected)
- self.assertTrue(bss_hostapd[1].list_sta())
+ bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % device.address)
+
device.disconnect()
condition = 'not obj.connected'
diff --git a/autotests/testFT-8021x-roam/connection_test.py b/autotests/testFT-8021x-roam/connection_test.py
@@ -27,7 +27,7 @@ class Test(unittest.TestCase):
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
- self.assertTrue(self.bss_hostapd[0].list_sta())
+ self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
self.assertFalse(self.bss_hostapd[1].list_sta())
testutil.test_iface_operstate(device.name)
@@ -46,7 +46,7 @@ class Test(unittest.TestCase):
to_condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_change(device, from_condition, to_condition)
- self.assertTrue(self.bss_hostapd[1].list_sta())
+ self.bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % device.address)
testutil.test_iface_operstate(device.name)
testutil.test_ifaces_connected(self.bss_hostapd[1].ifname, device.name)
diff --git a/autotests/testFT-FILS/connection_test.py b/autotests/testFT-FILS/connection_test.py
@@ -28,7 +28,8 @@ class Test(unittest.TestCase):
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
- self.assertTrue(self.bss_hostapd[0].list_sta())
+ self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
+
self.assertFalse(self.bss_hostapd[1].list_sta())
testutil.test_iface_operstate(device.name)
@@ -51,7 +52,8 @@ class Test(unittest.TestCase):
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
- self.assertTrue(self.bss_hostapd[0].list_sta())
+ self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
+
self.assertFalse(self.bss_hostapd[1].list_sta())
testutil.test_iface_operstate(device.name)
@@ -77,7 +79,7 @@ class Test(unittest.TestCase):
to_condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_change(device, from_condition, to_condition)
- self.assertTrue(self.bss_hostapd[1].list_sta())
+ self.bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % device.address)
testutil.test_iface_operstate(device.name)
testutil.test_ifaces_connected(self.bss_hostapd[1].ifname, device.name)
diff --git a/autotests/testOWE/connection_test.py b/autotests/testOWE/connection_test.py
@@ -60,7 +60,7 @@ class Test(unittest.TestCase):
to_condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_change(device, from_condition, to_condition)
- self.assertTrue(hapd1.list_sta())
+ hapd1.wait_for_event('AP-STA-CONNECTED %s' % device.address)
testutil.test_iface_operstate(device.name)
testutil.test_ifaces_connected(hapd1.ifname, device.name)
diff --git a/autotests/testPreauth-roam/connection_test.py b/autotests/testPreauth-roam/connection_test.py
@@ -49,7 +49,7 @@ class Test(unittest.TestCase):
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
- self.assertTrue(bss_hostapd[0].list_sta())
+ bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
self.assertFalse(bss_hostapd[1].list_sta())
testutil.test_iface_operstate(device.name)
@@ -70,7 +70,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)
testutil.test_iface_operstate(device.name)
testutil.test_ifaces_connected(bss_hostapd[1].ifname, device.name)