test: refactor wireless tests into single setup and cleanup#877
Conversation
📝 WalkthroughWalkthroughConsolidates mock Wi‑Fi setup into a parameterized ChangesMock WiFi Test Infrastructure Consolidation
🚥 Pre-merge checks | ✅ 4 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #877 +/- ##
==========================================
+ Coverage 43.11% 43.19% +0.07%
==========================================
Files 12 13 +1
Lines 3124 3172 +48
==========================================
+ Hits 1347 1370 +23
- Misses 1777 1802 +25 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/tasks/setup_mock_wifi.yml`:
- Around line 40-44: The CentOS-specific bootstrap tasks named "Check if can
test on CentOS and setup if possible" (and the later similar block around lines
65-71) should skip when the test harness is in wired 802.1x mode; add a
condition to each block to require "__mock_wifi_mode != '802_1x'" (e.g., include
it in the when: list alongside the existing ansible_facts checks) so the
mac80211_hwsim/mac80211 package bootstrap is not executed for wired tests.
- Around line 244-247: In tests/tasks/setup_mock_wifi.yml update the shell task
that calls "modprobe mac80211_hwsim" to pass the correct module parameter name:
change the conditional that currently emits "radio=2" to "radios=2" (the
conditional tied to __mock_wifi_mode in the same shell line), so the module gets
the simulated radio count properly when __mock_wifi_mode is 'owe' or 'sae'.
In `@tests/tests_802_1x_nm.yml`:
- Around line 35-36: The change was made to the generated YAML
(tests/tests_802_1x_nm.yml) but the generator source still uses the old
conditional for playbooks/tests_802_1x.yml; update the generator rule (not just
the rendered file) so the canonical condition matches the new form
(__network_distro_major_version | int >= 7) in the generator that produces
tests/tests_802_1x_nm.yml — find and modify the rule/templating logic referenced
by tests/ensure_provider_tests.py (the check that expects
playbooks/tests_802_1x.yml) so it emits the updated condition consistently and
regenerate the YAML.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: f09a002c-ed91-4014-8441-de29f5f35764
📒 Files selected for processing (16)
tests/ensure_provider_tests.pytests/playbooks/tests_802_1x.ymltests/playbooks/tests_wireless.ymltests/playbooks/tests_wireless_wpa3_owe.ymltests/playbooks/tests_wireless_wpa3_sae.ymltests/tasks/cleanup_802_1x_server.ymltests/tasks/cleanup_mock_wifi.ymltests/tasks/setup_802.1x.ymltests/tasks/setup_802_1x_server.ymltests/tasks/setup_mock_wifi.ymltests/tasks/setup_mock_wifi_wpa3_owe.ymltests/tasks/setup_mock_wifi_wpa3_sae.ymltests/tasks/start_mock_wifi.ymltests/tests_802_1x_nm.ymltests/tests_wireless_nm.ymltests/tests_wireless_wpa3_owe_nm.yml
💤 Files with no reviewable changes (7)
- tests/tasks/start_mock_wifi.yml
- tests/tasks/setup_mock_wifi_wpa3_sae.yml
- tests/tasks/setup_802_1x_server.yml
- tests/tasks/cleanup_802_1x_server.yml
- tests/tasks/setup_802.1x.yml
- tests/tasks/setup_mock_wifi_wpa3_owe.yml
- tests/playbooks/tests_wireless.yml
81c4045 to
8da0a85
Compare
|
[citest] |
8da0a85 to
f2d6a96
Compare
|
[citest] |
The wireless test setup/cleanup had a lot of duplicated code scattered among a few task files. This unifies the setup and cleanup code and gets rid of redundant files. This also enables all of the wireless tests on CentOS 7 and later, and RHEL 8 and later. Signed-off-by: Rich Megginson <rmeggins@redhat.com>
f2d6a96 to
2cf86d5
Compare
|
[citest] |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/ensure_provider_tests.py (1)
1-11:⚠️ Potential issue | 🟠 MajorFix formatting/lint for tests/ensure_provider_tests.py (Black/flake8 don’t pass as requested).
python -m black --checkfails in this environment:No module named black(usetox -e black,flake8for the actual check).flake8fails with multipleE501 line too longviolations (e.g., lines 33, 57-61, 92-96, 154-161, 166-175, 180, 184, 204, 208, 210, 217, 242, 261, 292, 306, 321).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/ensure_provider_tests.py` around lines 1 - 11, The test module has multiple flake8 E501 (line too long) violations and needs formatting; run the project formatter/linter via the established dev command (tox -e black,flake8) and fix violations by wrapping long lines to the configured line length (use implicit string concatenation, parentheses, or split long strings/expressions into variables), break long list/dict literals across lines, and refactor overly long assertions or error messages into shorter parts; also ensure imports and the module docstring remain within line length and re-run the checks until clean.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@tests/ensure_provider_tests.py`:
- Around line 1-11: The test module has multiple flake8 E501 (line too long)
violations and needs formatting; run the project formatter/linter via the
established dev command (tox -e black,flake8) and fix violations by wrapping
long lines to the configured line length (use implicit string concatenation,
parentheses, or split long strings/expressions into variables), break long
list/dict literals across lines, and refactor overly long assertions or error
messages into shorter parts; also ensure imports and the module docstring remain
within line length and re-run the checks until clean.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 1fc9b8a6-1345-44d6-8097-86043d2ce393
📒 Files selected for processing (18)
tests/ensure_provider_tests.pytests/playbooks/tests_802_1x.ymltests/playbooks/tests_wireless.ymltests/playbooks/tests_wireless_wpa3_owe.ymltests/playbooks/tests_wireless_wpa3_sae.ymltests/tasks/cleanup_802_1x_server.ymltests/tasks/cleanup_mock_wifi.ymltests/tasks/setup_802.1x.ymltests/tasks/setup_802_1x_server.ymltests/tasks/setup_mock_wifi.ymltests/tasks/setup_mock_wifi_wpa3_owe.ymltests/tasks/setup_mock_wifi_wpa3_sae.ymltests/tasks/start_mock_wifi.ymltests/tests_802_1x_nm.ymltests/tests_802_1x_updated_nm.ymltests/tests_wireless_nm.ymltests/tests_wireless_wpa3_owe_nm.ymltests/tests_wireless_wpa3_sae_nm.yml
💤 Files with no reviewable changes (7)
- tests/playbooks/tests_wireless.yml
- tests/tasks/start_mock_wifi.yml
- tests/tasks/setup_802.1x.yml
- tests/tasks/setup_mock_wifi_wpa3_sae.yml
- tests/tasks/setup_802_1x_server.yml
- tests/tasks/cleanup_802_1x_server.yml
- tests/tasks/setup_mock_wifi_wpa3_owe.yml
🚧 Files skipped from review as they are similar to previous changes (7)
- tests/playbooks/tests_wireless_wpa3_owe.yml
- tests/playbooks/tests_wireless_wpa3_sae.yml
- tests/tests_wireless_wpa3_sae_nm.yml
- tests/playbooks/tests_802_1x.yml
- tests/tests_wireless_wpa3_owe_nm.yml
- tests/tasks/cleanup_mock_wifi.yml
- tests/tasks/setup_mock_wifi.yml
|
[citest_bad] |
The wireless test setup/cleanup had a lot of duplicated code scattered
among a few task files. This unifies the setup and cleanup code and
gets rid of redundant files.
Signed-off-by: Rich Megginson rmeggins@redhat.com
Summary by CodeRabbit
Tests
Chores