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

auto-t: SAQuery-spoofing replace sleep with condition wait

By sleeping for 4 seconds IWD had plenty of time to fully disconnect
and reconnect in time to pass the final "connected" check. Instead
use wait_for_object_condition to wait for disconnected and expect
this to fail. This will let the test fail if IWD disconnects.
This commit is contained in:
James Prestwood 2021-10-19 11:19:05 -07:00 committed by Denis Kenzior
parent bf5afa52e5
commit 1c86327029

View File

@ -51,8 +51,10 @@ class Test(unittest.TestCase):
# Spoof a disassociate frame. This will kick off SA Query procedure.
hwsim.spoof_disassociate(radio, hostapd.frequency, device.address)
# sleep to ensure hostapd responds and SA Query does not timeout
sleep(4)
# ensure hostapd responds and SA Query does not timeout
with self.assertRaises(TimeoutError):
condition = 'obj.state == DeviceState.disconnected'
wd.wait_for_object_condition(device, condition, 4)
# Since disassociate was spoofed we should still be connected
condition = 'obj.state == DeviceState.connected'