Only deactivate activated connections in wifi_nmcli_test.py (BugFix) #2246
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR updates
turn_down_nm_connections()to deactivate only Wi-Fi connections currently in the activated state. It re-queries NetworkManager connections and repeats until no activated Wi-Fi connection remains.Resolved issues
When running Wireless networking tests with NetworkManager,
turn_down_nm_connections()may attempt to deactivate saved Wi-Fi profiles that are not active. In that case,nmcli connection down <uuid>fails with:Error: '<uuid>' is not an active connectionError: no active connection providedreturned non-zero exit status 10This change deactivates only activated Wi-Fi connections and loops until none remain, preventing the above failure.
Ref: WTN-323 (oem bug)
Documentation
Tests
Environment:
Steps:
Verify with
nmcli connection show. For example, SSID4F-1VC2-A45is active onwlp2s0f0, and SSID4F-1VC2-A35is not active:checkbox-cli <Ubuntu_launcher>(replace with your launcher name if different)Desktop Preload Certification Tests for 24.04→
Wireless networking tests→
wireless/wireless_connection_wpa_ax_nm_<interface>( is auto-detected, e.g. wlp2s0f0)Expected result:
turn_down_nm_connections()only deactivates connections in activated state.Failure example (before this change):
nmcli c down <uuid>Error: '<uuid>' is not an active connectionError: no active connection providedreturned non-zero exit status 10failure reference: