Migrate old wlan_policy_lib usage
A previous change (https://fxrev.dev/922309) refactored the method names
of wlan_policy_lib, but missed StartStopClientConnectionsTest. This
wasn't caught by mypy because an untyped function was accessing
FuchsiaDevice's wlan_policy_lib.
Change-Id: Ia589b55f035944bf50bde5e52c918dd8b9e8dda0
Reviewed-on: https://fuchsia-review.googlesource.com/c/antlion/+/924136
Reviewed-by: Patrick Lu <patricklu@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
Fuchsia-Auto-Submit: Sam Balana <sbalana@google.com>
diff --git a/tests/wlan_policy/StartStopClientConnectionsTest.py b/tests/wlan_policy/StartStopClientConnectionsTest.py
index bba800f..82f5a6b 100644
--- a/tests/wlan_policy/StartStopClientConnectionsTest.py
+++ b/tests/wlan_policy/StartStopClientConnectionsTest.py
@@ -16,11 +16,13 @@
import logging
import time
+from typing import Any
from mobly import signals, test_runner
from antlion.controllers.access_point import setup_ap
from antlion.controllers.ap_lib import hostapd_constants, hostapd_security
+from antlion.controllers.fuchsia_device import FuchsiaDevice
from antlion.test_utils.wifi import base_test
from antlion.utils import rand_ascii_str
@@ -96,15 +98,16 @@
)
raise signals.TestFailure("Failed to get expected connect response")
- def await_state_update(self, fd, desired_state, timeout):
+ def await_state_update(
+ self, fd: FuchsiaDevice, desired_state: Any, timeout_sec: int
+ ):
"""This function polls the policy client state until it converges to
the caller's desired state.
Args:
fd: A FuchsiaDevice
desired_state: The expected client policy state.
- timeout: Number of seconds to wait for the policy state to become
- the desired_state.
+ timeout_sec: Duration to wait for the desired_state.
Returns:
None assuming the desired state has been reached.
Raises:
@@ -112,9 +115,9 @@
"""
start_time = time.time()
curr_state = None
- while time.time() < start_time + timeout:
- fd.sl4f.wlan_policy_lib.wlanSetNewListener()
- curr_state = fd.sl4f.wlan_policy_lib.wlanGetUpdate()
+ while time.time() < start_time + timeout_sec:
+ fd.sl4f.wlan_policy_lib.set_new_listener()
+ curr_state = fd.sl4f.wlan_policy_lib.get_update()
if curr_state.get("error"):
self.log.error(
f"Error occurred getting status update: {curr_state.get('error')}"
@@ -127,9 +130,8 @@
time.sleep(1)
self.log.error(
- "Client state did not converge to the expected state in %s "
- "seconds. Expected update: %s Actual update: %s"
- % (timeout, desired_state, curr_state)
+ f"Client state did not converge to the expected state in {timeout_sec}s. "
+ f"Expected update: {desired_state} Actual update: {curr_state}"
)
raise signals.TestFailure("Client policy layer is in unexpected state")