auto-t: explicitly scan in testConnectAutoconnect
PATCH v2 1/1 auto-t: explicitly scan in testConnectAutoconnect
In certain cases the autoconnect portion of each subtest was connecting to the network so fast that the check for obj.scanning was never successful since IWD was already connected (and in turn not scanning). Since the autoconnect path will wait for the device to be connected there really isn't a reason to wait for any scanning conditions. The normal connect path does need to wait for scanning though, and for this an explicit call to scan was added to ensure the network list gets populated.
--- autotests/testConnectAutoconnect/validation.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
autotests/testConnectAutoconnect/validation.py +8 -6
@@ -12,6 +12,14 @@ from iwd import NetworkType class TestConnectAutoConnect(unittest.TestCase): def check_connect(self, wd, device, ssid, throws): + device.scan() + + condition = 'obj.scanning' + wd.wait_for_object_condition(device, condition) + + condition = 'not obj.scanning' + wd.wait_for_object_condition(device, condition) + ordered_network = device.get_ordered_network(ssid) condition = 'not obj.connected'
@@ -54,12 +62,6 @@ class TestConnectAutoConnect(unittest.TestCase): self.assertIsNotNone(devices) device = devices[0] - condition = 'obj.scanning' - wd.wait_for_object_condition(device, condition) - - condition = 'not obj.scanning' - wd.wait_for_object_condition(device, condition) - if autoconnect: self.check_autoconnect(wd, device, ssid, throws) else:
Signature · 1 line
2.21.1
Hi James,
Quoted 7 lines · James Prestwood
In certain cases the autoconnect portion of each subtest was connecting to the network so fast that the check for obj.scanning was never successful since IWD was already connected (and in turn not scanning). Since the autoconnect path will wait for the device to be connected there really isn't a reason to wait for any scanning conditions. The normal connect path does need to wait for scanning though, and for this an explicit call to scan was added to ensure the network list gets populated.
You might want to reuse the logic in testEAP-TLS etc. where it first checks if the scan is needed and then does what you did here,
condition = 'not obj.scanning' wd.wait_for_object_condition(device, condition)
if not device.get_ordered_networks():
device.scan()
condition = 'obj.scanning' wd.wait_for_object_condition(device, condition) condition = 'not obj.scanning' wd.wait_for_object_condition(device, condition)
ordered_network = device.get_ordered_network(ssid)
On the other hand when Scan() returns "Scanning" is supposed be true immediately or a millisecond later, so we might want to add a short timeout or convert this to an assert.
Best regards