commit e81b1b77c8a6cf04567f58e0daf458a60c532430
parent b437bfacede3a6361d048f537f59a162a69932c0
Author: James Prestwood <prestwoj@gmail.com>
Date: Thu, 10 Sep 2020 16:12:43 -0700
auto-t: fix testAPRoam
This test occationally fails due to no hwsim rules. Basically we
were just expecting iwd to connect to one of 3 access points but
the ranking was equal, so it chose the first in the scan list.
Now a signal strength is assigned to each AP to steer IWD into
connecting to the expected AP.
Diffstat:
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/autotests/testAPRoam/connection_test.py b/autotests/testAPRoam/connection_test.py
@@ -24,6 +24,22 @@ class Test(unittest.TestCase):
hwsim.get_radio('rad1'),
hwsim.get_radio('rad2') ]
+ rule0 = hwsim.rules.create()
+ rule0.source = bss_radio[0].addresses[0]
+ rule0.bidirectional = True
+
+ rule1 = hwsim.rules.create()
+ rule1.source = bss_radio[1].addresses[0]
+ rule1.bidirectional = True
+
+ rule2 = hwsim.rules.create()
+ rule2.source = bss_radio[2].addresses[0]
+ rule2.bidirectional = True
+
+ rule0.signal = -2000
+ rule1.signal = -2500
+ rule2.signal = -3000
+
wd = IWD()
psk_agent = PSKAgent("secret123")
@@ -49,8 +65,10 @@ class Test(unittest.TestCase):
ordered_network.network_object.connect()
- condition = 'obj.connected'
- wd.wait_for_object_condition(ordered_network.network_object, condition)
+ condition = 'obj.state == DeviceState.connected'
+ wd.wait_for_object_condition(device, condition)
+
+ bss_hostapd[0].wait_for_event('AP-STA-CONNECTED')
self.assertTrue(bss_hostapd[0].list_sta())
self.assertFalse(bss_hostapd[1].list_sta())
@@ -65,6 +83,9 @@ class Test(unittest.TestCase):
condition = 'obj.state != DeviceState.roaming'
wd.wait_for_object_condition(device, condition)
+ 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())
device.disconnect()
@@ -74,6 +95,10 @@ class Test(unittest.TestCase):
wd.unregister_psk_agent(psk_agent)
+ rule0.remove()
+ rule1.remove()
+ rule2.remove()
+
@classmethod
def setUpClass(cls):
pass