Skip to content

Conversation

@Jefferyyen
Copy link
Contributor

@Jefferyyen Jefferyyen commented Dec 15, 2025

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 connection
  • Error: no active connection provided
  • returned non-zero exit status 10

This change deactivates only activated Wi-Fi connections and loops until none remain, preventing the above failure.

Ref: WTN-323 (oem bug)

Documentation

Tests

Environment:

  • Ubuntu 24.04
  • NetworkManager (nmcli)
  • Checkbox 6.0.0.dev90

Steps:

  1. Before running Checkbox, ensure the DUT has:

at least one Wi-Fi connection in "activated" state (connected to an AP), and
at least one saved Wi-Fi profile that is not active.

Verify with nmcli connection show. For example, SSID 4F-1VC2-A45 is active on wlp2s0f0, and SSID 4F-1VC2-A35 is not active:

jfy@jfy:~$ nmcli connection show
NAME         UUID                                  TYPE      DEVICE   
4F-1VC2-A45  47e857fd-f5cc-4a2b-ac71-c336cca8251b  wifi      wlp2s0f0 
lo           6a0de5a2-310d-433d-865f-0feaf4bc1bbe  loopback  lo       
4F-1VC2-A35  ba001808-66a7-4392-8f74-bc45d45f1649  wifi      --       
jfy@jfy:~$
  1. Set up the environment using the Checkbox Ubuntu launcher.
  2. Run: checkbox-cli <Ubuntu_launcher> (replace with your launcher name if different)
  3. Select:
    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.
  • It stops once no activated Wi-Fi connection remains.
  • The test no longer fails with exit status 10 due to attempting to deactivate inactive profiles.

Failure example (before this change):

  • nmcli c down <uuid>
  • Error: '<uuid>' is not an active connection
  • Error: no active connection provided
  • returned non-zero exit status 10

failure reference:

======================================
Attempt 1/5 (function 'device_rescan')
======================================
## Calling a rescan
+ nmcli d wifi rescan

## List APs with ESSID: 4F-1VC2-A35
SSID: 4F-1VC2-A35 Chan: 44 Freq: 5220 MHz Signal: 60

## Cleaning up TEST_CON connection
+ nmcli -t -f TYPE,UUID,NAME,STATE connection
No TEST_CON connection found, nothing to delete
## Get NM activate connection name
+ nmcli -t -f TYPE,UUID,NAME,STATE connection
## Turn off NM all connections
+ nmcli -t -f TYPE,UUID,NAME,STATE connection
Turn down connection 4F-1VC2-A35
+ nmcli c down 6a3cc2d6-d581-458d-a291-3edd8240ce73
Error: '6a3cc2d6-d581-458d-a291-3edd8240ce73' is not an active connection.
Error: no active connection provided.
Attempt 4 failed:
Command '['nmcli', 'c', 'down', '6a3cc2d6-d581-458d-a291-3edd8240ce73']' returned non-zero exit status 10.

Waiting 28.99 seconds before retrying...

@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.70%. Comparing base (7b1ebd5) to head (3264cdf).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2246   +/-   ##
=======================================
  Coverage   53.70%   53.70%           
=======================================
  Files         401      401           
  Lines       43144    43146    +2     
  Branches     7996     7997    +1     
=======================================
+ Hits        23170    23172    +2     
  Misses      19161    19161           
  Partials      813      813           
Flag Coverage Δ
provider-base 30.91% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant