tests: Assert ethernet profile and device state#793
tests: Assert ethernet profile and device state#793martinpitt merged 2 commits intolinux-system-roles:mainfrom
Conversation
Reviewer's GuideThis PR implements actual on-disk and runtime validation for Ethernet profiles in the tests_ethernet playbook—using conditional slurp and assert tasks for both NetworkManager and initscripts backends—and streamlines the 802.1x test by replacing a complex boolean assertion with a simple equality check and pruning outdated NM version entries. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[citest] |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #793 +/- ##
==========================================
+ Coverage 43.11% 43.25% +0.13%
==========================================
Files 12 12
Lines 3124 3121 -3
==========================================
+ Hits 1347 1350 +3
+ Misses 1777 1771 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
My new test passes everywhere 🎉 The F42 failures are known, due to "Conditionals must have a boolean result" and other Ansible 2.19 problems. I'll go through and fix at least some of them. The two C10 failures are the same as in #792. ("connection failed while waiting: connection not activated: no-secrets"). This is some OpenSSL problem: ansible-lint failures are due to the new "unique" check. I'll disable it for the time being, let's shave one yak at a time. However, there is another type of Ansible 2.19 failure: The network tests are written in a really weird way where pretty much every step that should be a task is its own playbook. However, the top does - name: Test configuring bridges
hosts: all
tasks:
- name: Define vars
set_fact:
interface: "LSR-TST-br31"
cloned_mac: "12:23:34:45:56:70"so shouldn't that fact be available across playbooks, as documented? Maybe that's not true any more for jinja expansion? But then why does it only fail in line 57, and not already before, when it does the setup and role invocation (which also use |
0b9f5e9 to
2a07fb8
Compare
|
This should now fix most of the Ansible 2.19 failures. I still get a failure of tests_default_nm.yml and tests_ethernet_nm.yml due to two unexpected warnings:
That's something else, and I'll ignore that for this round -- this needs an adult. |
|
[citest] |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
@martinpitt These ansible 2.19 issues look pretty difficult - I think I need to take a look at these in the next few days - for now, don't worry about them - just focus on the work required for bootc support |
|
Thanks, the restart helped. So this is ready for review now. It fixes most of the failures, the remaining ones are more difficult. I'll leave them to @richm as discussed. My original goal here was just to land the new integration test checks (they are useful for bootc validation), and then I couldn't resist 😁 |
selinux was already done: linux-system-roles/selinux@beabf096278748b2ec network is being done in linux-system-roles/network#793
There was a problem hiding this comment.
Hey @martinpitt - I've reviewed your changes - here's some feedback:
- The repeated
when: network_provider == 'nm' and ansible_distribution_major_version|int >= 9checks across tasks could be collapsed into a block with a single conditional or fact to reduce duplication. - The slurp + assert patterns for NM and initscripts backends are nearly identical—consider extracting them into a reusable task or role parameterized by backend to DRY up the playbook.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The repeated `when: network_provider == 'nm' and ansible_distribution_major_version|int >= 9` checks across tasks could be collapsed into a block with a single conditional or fact to reduce duplication.
- The slurp + assert patterns for NM and initscripts backends are nearly identical—consider extracting them into a reusable task or role parameterized by backend to DRY up the playbook.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
selinux was already done: linux-system-roles/selinux@beabf096278748b2ec network is being done in linux-system-roles/network#793
|
@richm: If you prefer, I can take out the big commit tests: Clean up profile cleanup helper playbooks and just submit the first four - they should be obvious. (Or submit them in a new PR) |
I think it would be better to take them out - some of those changes conflict with #794 |
|
@richm aye, done. |
|
@richm I removed the 'ignore unique ansible-lint' commit as well, as you fixed that differently in your PR. |
|
[citest] |
|
I rebased after #794. That already applied the same variable fix to test_802.1x_capath than this PR, but I still kept the cleanup. |
|
[citest] |
Simplify the cumbersome assertion. Drop the ancient Fedora releases from the __NM_capath_ignored_NVRs list. Signed-off-by: Martin Pitt <mpitt@redhat.com>
Implement the tests_ethernet FIXMEs for actually validating the `nmcli` state and generated on-disk profiles. Do the latter separately in anticipation of future support for offline (bootc build) mode. This needs some conditionals, as NetworkManager before RHEL 9 uses the initscripts config backend. Signed-off-by: Martin Pitt <mpitt@redhat.com>
|
Similar CentOS 10 failures as in the most recently landed PR #794, see log from that. The wireless tests failed on F42 because of data center move outages: So I'll just wait for a few days, this PR isn't very urgent. |
|
[citest] |
There was a problem hiding this comment.
Hey @martinpitt - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
@liangwen12year can you please have a look? Thanks! |
| when: | ||
| - network_provider == 'nm' | ||
| # RHEL up to 8 uses initscripts backend | ||
| - ansible_distribution_major_version | int >= 9 |
There was a problem hiding this comment.
Why is this necessary? Isn't when: network_provider == 'nm' sufficient?
There was a problem hiding this comment.
No -- even with the NM backend, NM in RHEL < 9 is configured to store the connections in the old initscripts format; in 9 it moved to the NM-specific /etc/NetworkManager/system-connections/ ini files.
Implement the tests_ethernet FIXMEs for actually validating the
nmclistate and generated on-disk profiles. Do the latter separately in anticipation of future support for offline (bootc build) mode.This needs some conditionals, as NetworkManager before RHEL 9 uses the initscripts config backend.
Summary by Sourcery
Enhance the Ethernet test suite to assert actual NetworkManager and initscripts profile settings and interface status, and clean up the 802.1x capath test by pruning outdated NVR checks and streamlining its assertion logic
Tests: