auto-t: fix hidden network test

This test was never 100% reliable, and after the test-runner re-write
it became extremely unreliable. The issue came down to the very common
block of code thats present in many tests where we wait for obj.scanning
then not obj.scanning. This is fine when a dbus scan() is explicitly
done before, otherwise it could lead to problems. Without a dbus scan
explicitly called we are assuming a periodic scan will happen. If it
already happen the initial wait for obj.scanning will never return and
time out.

This probably needs to be changed in several tests, but for this specific
case we can remove the waits completely. Since
check_autoconnect_hidden_network has a 30 second wait on
DeviceState.connected this will ultimately time out if anything goes
wrong. There isn't any great reason to wait for scanning (for this test
specifically).

A minor style change was also made when initializing IWD. The values
passed in this test are now the default, so no arguments need to be
passed.
This commit is contained in:
James Prestwood 2020-09-10 16:12:29 -07:00 committed by Denis Kenzior
parent 3ec3855de9
commit 2bd2462968
2 changed files with 2 additions and 8 deletions

View File

@ -27,7 +27,7 @@ class TestConnectionAfterHiddenNetwork(unittest.TestCase):
self._ex = ex
def test_connection(self):
wd = IWD(True, '/tmp')
wd = IWD(True)
psk_agent = PSKAgent("secret123")
wd.register_psk_agent(psk_agent)

View File

@ -50,11 +50,6 @@ class TestConnectAutoConnect(unittest.TestCase):
device = devices[0]
if autoconnect:
condition = 'obj.scanning'
wd.wait_for_object_condition(device, condition)
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
self.check_autoconnect_hidden_network(wd, device, ssid, throws)
else:
if wait_periodic_scan:
@ -71,7 +66,6 @@ class TestConnectAutoConnect(unittest.TestCase):
def validate(self, ssid, autoconnect, throws = None, use_agent = False,
wait_periodic_scan = False):
wd = IWD(True, '/tmp')
wd = IWD(True)
self.validate_connection(wd, ssid, autoconnect, throws, use_agent,
wait_periodic_scan)