commit 1c86327029788fb9bc61a3c420ea35ee6b472b05
parent bf5afa52e504654f7b98c62a8ba861cdcc456590
Author: James Prestwood <prestwoj@gmail.com>
Date: Tue, 19 Oct 2021 11:19:05 -0700
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.
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/autotests/testSAQuery-spoofing/connection_test.py b/autotests/testSAQuery-spoofing/connection_test.py
@@ -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'