From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH v2 5/6] auto-t: update several tests to work with netconfig refactor
Date: Wed, 28 May 2025 13:10:25 -0700 [thread overview]
Message-ID: <20250528201026.598221-5-prestwoj@gmail.com> (raw)
In-Reply-To: <20250528201026.598221-1-prestwoj@gmail.com>
Since the method return to Connect() and ConnectBssid() come after
netconfig some tests needed to be updated since they were waiting
for the method return before continuing. For timeout-based tests
specifically this caused them to fail since before they expected
the return to come before the connection was actually completed.
---
autotests/testNetconfig/static_test.py | 15 +++-----
autotests/testNetconfig/timeout_test.py | 35 +++++++++++++------
.../testNetconfigRoam/netconfig_roam_test.py | 2 +-
3 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/autotests/testNetconfig/static_test.py b/autotests/testNetconfig/static_test.py
index 94307a8c..61037e0e 100644
--- a/autotests/testNetconfig/static_test.py
+++ b/autotests/testNetconfig/static_test.py
@@ -91,16 +91,11 @@ class Test(unittest.TestCase):
# using the same static config. The new client's ACD client should
# detect an IP conflict and not allow the device to reach the
# "connected" state although the DBus .Connect call will succeed.
- ordered_network.network_object.connect()
- self.assertEqual(dev2.state, iwd.DeviceState.connecting)
- try:
- # We should either stay in "connecting" indefinitely or move to
- # "disconnecting"
- condition = 'obj.state != DeviceState.connecting'
- iwd_ns0_1.wait_for_object_condition(dev2, condition, max_wait=21)
- self.assertEqual(dev2.state, iwd.DeviceState.disconnecting)
- except TimeoutError:
- dev2.disconnect()
+ with self.assertRaises(iwd.FailedEx):
+ ordered_network.network_object.connect(timeout=500)
+
+ condition = 'obj.state == DeviceState.disconnected'
+ iwd_ns0_1.wait_for_object_condition(dev2, condition, max_wait=21)
iwd_ns0_1.unregister_psk_agent(psk_agent_ns0_1)
del dev2
diff --git a/autotests/testNetconfig/timeout_test.py b/autotests/testNetconfig/timeout_test.py
index a15706e3..00b03df4 100644
--- a/autotests/testNetconfig/timeout_test.py
+++ b/autotests/testNetconfig/timeout_test.py
@@ -8,6 +8,8 @@ from iwd import PSKAgent
from iwd import NetworkType
class Test(unittest.TestCase):
+ def connect_failure(self, ex):
+ self.failure_triggered = True
def test_netconfig_timeout(self):
IWD.copy_to_storage('autoconnect.psk', name='ap-ns1.psk')
@@ -27,23 +29,34 @@ class Test(unittest.TestCase):
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
- ordered_network.network_object.connect()
+ self.failure_triggered = False
- condition = 'obj.state == DeviceState.connecting'
- wd.wait_for_object_condition(device, condition)
+ # Set our error handler here so we can check if it fails
+ ordered_network.network_object.connect(
+ wait=False,
+ timeout=1000,
+ error_handler=self.connect_failure
+ )
+
+ # IWD should attempt to try both BSS's with both failing netconfig.
+ # Then the autoconnect list should be exhausted, and IWD should
+ # transition to a disconnected state, then proceed to full autoconnect.
+ device.wait_for_event("netconfig-failed", timeout=1000)
+ device.wait_for_event("netconfig-failed", timeout=1000)
+ device.wait_for_event("disconnected")
- device.wait_for_event("connecting (netconfig)")
+ device.wait_for_event("autoconnect_full")
- # Netconfig should fail, and IWD should disconnect
- from_condition = 'obj.state == DeviceState.connecting'
- to_condition = 'obj.state == DeviceState.disconnecting'
- wd.wait_for_object_change(device, from_condition, to_condition, max_wait=60)
+ # The connect call should have failed
+ self.assertTrue(self.failure_triggered)
- # Autoconnect should then try again
- condition = 'obj.state == DeviceState.connecting'
+ condition = "obj.scanning"
+ wd.wait_for_object_condition(device, condition)
+ condition = "not obj.scanning"
wd.wait_for_object_condition(device, condition)
- device.wait_for_event("connecting (netconfig)")
+ # IWD should attempt to connect, but it will of course fail again.
+ device.wait_for_event("netconfig-failed", timeout=1000)
device.disconnect()
condition = 'obj.state == DeviceState.disconnected'
diff --git a/autotests/testNetconfigRoam/netconfig_roam_test.py b/autotests/testNetconfigRoam/netconfig_roam_test.py
index 63e5eabf..b7a7012f 100644
--- a/autotests/testNetconfigRoam/netconfig_roam_test.py
+++ b/autotests/testNetconfigRoam/netconfig_roam_test.py
@@ -19,7 +19,7 @@ class Test(unittest.TestCase):
device = wd.list_devices(1)[0]
device.get_ordered_network('TestFT', full_scan=True)
- device.connect_bssid(self.bss_hostapd[1].bssid)
+ device.connect_bssid(self.bss_hostapd[1].bssid, wait=False)
self.bss_hostapd[1].wait_for_event(f'AP-STA-CONNECTED {device.address}')
device.wait_for_event("connecting (netconfig)")
--
2.34.1
next prev parent reply other threads:[~2025-05-28 20:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-28 20:10 [PATCH v2 1/6] network: make clearing network blacklist a separate operation James Prestwood
2025-05-28 20:10 ` [PATCH v2 2/6] station: fix DBus reply for Connect() with netconfig James Prestwood
2025-05-28 20:10 ` [PATCH v2 3/6] station: include netconfig as part of the BSS retry logic James Prestwood
2025-05-28 20:10 ` [PATCH v2 4/6] auto-t: allow configurable DBus timeout/callbacks on connect{_bssid} James Prestwood
2025-05-28 20:10 ` James Prestwood [this message]
2025-05-28 20:10 ` [PATCH v2 6/6] doc: add note about timeouts to Network.Connect() James Prestwood
2025-06-05 15:02 ` [PATCH v2 1/6] network: make clearing network blacklist a separate operation Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250528201026.598221-5-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox