3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 14:49:24 +01:00

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.
This commit is contained in:
James Prestwood 2022-03-30 13:23:15 -07:00 committed by Denis Kenzior
parent 416ad05ce7
commit fa366c79e4
5 changed files with 12 additions and 11 deletions

View File

@ -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'

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)