Skip to content

Conversation

@Anatw
Copy link
Contributor

@Anatw Anatw commented Nov 30, 2025

Short description:

Make NNCP-related classes take a mandatory DynamicClient and update all NNCP-related fixtures to pass an admin_client explicitly (no implicit default clients).

NNCPs are cluster-wide resources, that affect cluster nodes. For this reason project admins cannot apply them and they must be applied by cluster admin (privileged clients).

What this PR does / why we need it:

As of its next releas, openshift-python-wrapper will enforce passing client when working with cluster resources.
openshift-virtualization-tests must align with this change.
All calls in the code to openshift-python-wrapper resources should be updated to pass client arg.

jira-ticket:

https://issues.redhat.com/browse/CNV-72392

Summary by CodeRabbit

  • Tests
    • Many test fixtures across networking, storage, and virtualization now accept and use an admin-level client so bridge, bond, VLAN and related setups run with authenticated/admin context.
  • Chores
    • Network helpers and policy constructors updated to accept and consistently forward an admin client, enabling admin-authenticated network operations in tests.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 30, 2025

Walkthrough

Threads a DynamicClient (admin_client) through many pytest fixtures, network helpers, and network policy classes; fixtures now accept admin_client and most calls pass client=admin_client into network_device, NNCP/policy constructors, and related helpers.

Changes

Cohort / File(s) Summary
Core library & helpers
tests/network/libs/nodenetworkconfigurationpolicy.py, utilities/network.py, tests/network/localnet/liblocalnet.py
Add client: DynamicClient / admin_client parameter to NodeNetworkConfigurationPolicy, multiple policy classes, network_device, and localnet helper; forward client into superclass initializers and NNCP creation paths.
Root/session fixtures
tests/conftest.py
Session-scoped fixtures updated to accept admin_client and pass client=admin_client into Ethernet/bridge policy creation.
Bridge & general network fixtures
tests/network/general/*, tests/network/connectivity/conftest.py, tests/network/dry_run/*, tests/network/kubemacpool/conftest.py, tests/network/l2_bridge/conftest.py, tests/network/macspoof/conftest.py, tests/network/migration/*, tests/network/nmstate/*, tests/storage/cdi_import/conftest.py, tests/virt/cluster/common_templates/windows/*
Many bridge/device fixtures now accept admin_client and pass client=admin_client into network_device() contexts.
Bond, VLAN, SR-IOV, jumbo-frame tests
tests/network/bond/*, tests/network/bgp/conftest.py, tests/network/jumbo_frame/*, tests/network/bond/test_l2_bridge_over_bond.py, tests/network/jumbo_frame/test_bond.py
Bond/VLAN/SR-IOV/jumbo-frame fixtures updated to accept admin_client; Bond/VLAN/Ethernet NNCP and BondNodeNetworkConfigurationPolicy now receive client=admin_client.
L2 bridge hot-plug utilities & tests
tests/network/l2_bridge/test_bridge_nic_hot_plug.py, tests/network/l2_bridge/utils.py
create_bridge_interface_for_hot_plug now requires client and passes it to network_device; hot-plug fixtures updated to accept and forward admin_client.
Localnet & NNCP fixtures
tests/network/localnet/conftest.py, tests/network/localnet/*
NNCP/localnet fixtures updated to accept admin_client and forward it into create_nncp_localnet_on_secondary_node_nic / NodeNetworkConfigurationPolicy; new jumbo-frame localnet fixture added.
Other tests updated
tests/install_upgrade_operators/must_gather/conftest.py, tests/network/bgp/conftest.py, tests/network/bond/test_bond_modes.py, tests/network/connectivity/conftest.py, tests/network/jumbo_frame/*, tests/network/nmstate/*, tests/network/l2_bridge/*, tests/network/kubemacpool/conftest.py, tests/network/general/*, tests/network/dry_run/test_dry_run_kubemacpool.py, tests/storage/cdi_import/conftest.py, tests/virt/cluster/common_templates/windows/*
Many fixtures across the suite updated to include admin_client and forward it as client=admin_client to policy/device constructors.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Repetitive pattern (add fixture param + forward client) reduces per-file complexity.
  • Pay extra attention to:
    • utilities/network.py — wide API changes; ensure client forwarded consistently to super().init and to all policy code paths.
    • tests/network/libs/nodenetworkconfigurationpolicy.py — constructor signature, typing, and proper propagation of client.
    • tests/network/localnet/liblocalnet.py and NNCP fixtures/helpers — context-manager/generator usage and new parameter ordering may affect fixtures.
    • Fixture dependency graph — ensure no circular dependencies or missing provider for admin_client.

Possibly related PRs

Suggested labels

can-be-merged

Suggested reviewers

  • yossisegev
  • rnetser
  • EdDev
  • vsibirsk
  • dshchedr
  • RoniKishner

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 24.59% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: requiring explicit client for NNCP (NodeNetworkConfigurationPolicy) classes, which is the core objective of this PR.
Description check ✅ Passed The PR description addresses the core change (mandatory DynamicClient for NNCP classes) and provides rationale (cluster-wide resources need cluster-admin privileges) and motivation (alignment with openshift-python-wrapper). However, the template sections are partially filled with only 'Short description', 'What this PR does / why we need it', and 'jira-ticket' populated; 'More details', 'Which issue(s) this PR fixes', and 'Special notes for reviewer' are missing or minimal.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-virtualization-qe-bot-3
Copy link
Contributor

Report bugs in Issues

Welcome! 🎉

This pull request will be automatically processed with the following features:

🔄 Automatic Actions

  • Reviewer Assignment: Reviewers are automatically assigned based on the OWNERS file in the repository root
  • Size Labeling: PR size labels (XS, S, M, L, XL, XXL) are automatically applied based on changes
  • Issue Creation: A tracking issue is created for this PR and will be closed when the PR is merged or closed
  • Pre-commit Checks: pre-commit runs automatically if .pre-commit-config.yaml exists
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified

📋 Available Commands

PR Status Management

  • /wip - Mark PR as work in progress (adds WIP: prefix to title)
  • /wip cancel - Remove work in progress status
  • /hold - Block PR merging (approvers only)
  • /hold cancel - Unblock PR merging
  • /verified - Mark PR as verified
  • /verified cancel - Remove verification status
  • /reprocess - Trigger complete PR workflow reprocessing (useful if webhook failed or configuration changed)

Review & Approval

  • /lgtm - Approve changes (looks good to me)
  • /approve - Approve PR (approvers only)
  • /automerge - Enable automatic merging when all requirements are met (maintainers and approvers only)
  • /assign-reviewers - Assign reviewers based on OWNERS file
  • /assign-reviewer @username - Assign specific reviewer
  • /check-can-merge - Check if PR meets merge requirements

Testing & Validation

  • /retest tox - Run Python test suite with tox
  • /retest build-container - Rebuild and test container image
  • /retest all - Run all available tests

Container Operations

  • /build-and-push-container - Build and push container image (tagged with PR number)
    • Supports additional build arguments: /build-and-push-container --build-arg KEY=value

Cherry-pick Operations

  • /cherry-pick <branch> - Schedule cherry-pick to target branch when PR is merged
    • Multiple branches: /cherry-pick branch1 branch2 branch3

Label Management

  • /<label-name> - Add a label to the PR
  • /<label-name> cancel - Remove a label from the PR

✅ Merge Requirements

This PR will be automatically approved when the following conditions are met:

  1. Approval: /approve from at least one approver
  2. LGTM Count: Minimum 2 /lgtm from reviewers
  3. Status Checks: All required status checks must pass
  4. No Blockers: No WIP, hold, or conflict labels
  5. Verified: PR must be marked as verified (if verification is enabled)

📊 Review Process

Approvers and Reviewers

Approvers:

  • EdDev
  • dshchedr
  • jpeimer
  • myakove
  • rnetser
  • vsibirsk

Reviewers:

  • Ahmad-Hafe
  • Anatw
  • EdDev
  • OhadRevah
  • RoniKishner
  • SamAlber
  • SiboWang1997
  • akri3i
  • albarker-rh
  • azhivovk
  • dalia-frank
  • dshchedr
  • duyanyan
  • hmeir
  • jerry7z
  • josemacassan
  • jpeimer
  • kbidarkar
  • kgoldbla
  • kshvaika
  • rlobillo
  • rnetser
  • servolkov
  • stesrn
  • vsibirsk
  • yossisegev
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
  • automerge

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is automatically removed on each new commit
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • Container Builds: Container images are automatically tagged with the PR number
  • Permission Levels: Some commands require approver permissions
  • Auto-verified Users: Certain users have automatic verification and merge privileges

For more information, please refer to the project documentation or contact the maintainers.

@Anatw
Copy link
Contributor Author

Anatw commented Nov 30, 2025

/build-and-push-container

@Anatw
Copy link
Contributor Author

Anatw commented Dec 7, 2025

Change: rebase on main, resolve a conflict in utilities/network.py

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
tests/conftest.py (1)

1073-1088: SR-IOV node policy fixture correctly injects admin_client (minor Ruff hint)

sriov_node_policy now threads admin_client through to create_sriov_node_policy(client=admin_client), which matches the new SR‑IOV/NNCP client contract. The workers_utility_pods parameter is intentionally unused to force that fixture to run first; if Ruff’s ARG001 warning is noisy, consider renaming it to _workers_utility_pods to document the intent and silence the linter.

utilities/network.py (1)

61-121: NNCP helpers now consistently require and propagate client

BridgeNodeNetworkConfigurationPolicy, its Linux/OVS subclasses, VLANInterfaceNodeNetworkConfigurationPolicy, BondNodeNetworkConfigurationPolicy, EthernetNetworkConfigurationPolicy, network_device, and create_sriov_node_policy all now take an explicit client and forward it down to NodeNetworkConfigurationPolicy/SriovNetworkNodePolicy, which cleanly removes reliance on implicit clients for NNCP creation. The wiring looks consistent across all call paths. If you later want to fully eliminate implicit clients, you could also thread client into the few NodeNetworkState constructions here, but that’s strictly a follow‑up polish.

Also applies to: 177-260, 338-375, 387-419, 585-627, 972-1015, 1077-1099

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5d8f84b and d99d908.

📒 Files selected for processing (26)
  • tests/conftest.py (4 hunks)
  • tests/install_upgrade_operators/must_gather/conftest.py (1 hunks)
  • tests/network/bgp/conftest.py (1 hunks)
  • tests/network/bond/test_bond_modes.py (9 hunks)
  • tests/network/bond/test_l2_bridge_over_bond.py (7 hunks)
  • tests/network/connectivity/conftest.py (5 hunks)
  • tests/network/dry_run/test_dry_run_kubemacpool.py (1 hunks)
  • tests/network/general/test_bridge_marker.py (1 hunks)
  • tests/network/general/test_cnv_tuning_regression.py (1 hunks)
  • tests/network/jumbo_frame/conftest.py (1 hunks)
  • tests/network/jumbo_frame/test_bond.py (7 hunks)
  • tests/network/jumbo_frame/test_bridge.py (3 hunks)
  • tests/network/kubemacpool/conftest.py (3 hunks)
  • tests/network/l2_bridge/conftest.py (3 hunks)
  • tests/network/l2_bridge/test_bridge_nic_hot_plug.py (2 hunks)
  • tests/network/l2_bridge/utils.py (2 hunks)
  • tests/network/libs/nodenetworkconfigurationpolicy.py (3 hunks)
  • tests/network/localnet/conftest.py (3 hunks)
  • tests/network/localnet/liblocalnet.py (3 hunks)
  • tests/network/macspoof/conftest.py (1 hunks)
  • tests/network/migration/test_migration.py (3 hunks)
  • tests/network/nmstate/conftest.py (4 hunks)
  • tests/network/nmstate/test_connectivity_after_nmstate_changes.py (1 hunks)
  • tests/storage/cdi_import/conftest.py (1 hunks)
  • tests/virt/cluster/common_templates/windows/test_windows_custom_options.py (1 hunks)
  • utilities/network.py (17 hunks)
🚧 Files skipped from review as they are similar to previous changes (13)
  • tests/install_upgrade_operators/must_gather/conftest.py
  • tests/virt/cluster/common_templates/windows/test_windows_custom_options.py
  • tests/network/nmstate/test_connectivity_after_nmstate_changes.py
  • tests/network/dry_run/test_dry_run_kubemacpool.py
  • tests/network/l2_bridge/utils.py
  • tests/network/l2_bridge/test_bridge_nic_hot_plug.py
  • tests/network/localnet/liblocalnet.py
  • tests/network/bond/test_bond_modes.py
  • tests/network/nmstate/conftest.py
  • tests/network/bgp/conftest.py
  • tests/network/libs/nodenetworkconfigurationpolicy.py
  • tests/network/jumbo_frame/test_bond.py
  • tests/network/macspoof/conftest.py
🧰 Additional context used
🧠 Learnings (15)
📓 Common learnings
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 1028
File: utilities/infra.py:1249-1254
Timestamp: 2025-08-06T13:57:51.928Z
Learning: User rnetser verified that all calls to get_infrastructure() function use the admin_client parameter, confirming that signature changes requiring this parameter don't cause breaking changes in the openshift-virtualization-tests codebase.
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 2469
File: utilities/sanity.py:139-142
Timestamp: 2025-11-08T07:36:57.616Z
Learning: In the openshift-virtualization-tests repository, user rnetser prefers to keep refactoring PRs (like PR #2469) strictly focused on moving/organizing code into more granular modules without adding new functionality, error handling, or behavioral changes. Such improvements should be handled in separate PRs.
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 0
File: :0-0
Timestamp: 2025-09-29T19:05:24.987Z
Learning: For PR #1904 test execution, the critical validation point is test_connectivity_over_migration_between_localnet_vms which should fail gracefully on cloud clusters but pass on bare-metal/PSI clusters, representing the core nmstate conditional logic functionality.
Learnt from: qwang1
Repo: RedHatQE/openshift-virtualization-tests PR: 1678
File: utilities/oadp.py:1-5
Timestamp: 2025-09-07T13:16:32.011Z
Learning: In the openshift-virtualization-tests project utilities/oadp.py, DynamicClient instances are passed as parameters rather than created internally, so kubernetes.config import is not needed for client creation fallback patterns.
📚 Learning: 2025-08-06T13:57:51.928Z
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 1028
File: utilities/infra.py:1249-1254
Timestamp: 2025-08-06T13:57:51.928Z
Learning: User rnetser verified that all calls to get_infrastructure() function use the admin_client parameter, confirming that signature changes requiring this parameter don't cause breaking changes in the openshift-virtualization-tests codebase.

Applied to files:

  • tests/network/connectivity/conftest.py
  • tests/conftest.py
  • tests/network/jumbo_frame/test_bridge.py
  • tests/network/l2_bridge/conftest.py
  • tests/network/jumbo_frame/conftest.py
  • tests/network/general/test_cnv_tuning_regression.py
  • tests/network/kubemacpool/conftest.py
  • tests/storage/cdi_import/conftest.py
  • tests/network/general/test_bridge_marker.py
  • tests/network/localnet/conftest.py
  • tests/network/migration/test_migration.py
  • tests/network/bond/test_l2_bridge_over_bond.py
📚 Learning: 2025-08-06T13:57:34.740Z
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 1028
File: utilities/infra.py:1257-1258
Timestamp: 2025-08-06T13:57:34.740Z
Learning: In the openshift-virtualization-tests repository, all existing calls to the `get_cluster_platform` function in utilities/infra.py already pass the `admin_client` parameter, so the breaking change requiring this parameter does not actually break any existing code.

Applied to files:

  • tests/network/connectivity/conftest.py
  • tests/conftest.py
  • tests/network/jumbo_frame/test_bridge.py
  • tests/network/l2_bridge/conftest.py
  • tests/network/jumbo_frame/conftest.py
  • tests/network/general/test_cnv_tuning_regression.py
  • tests/network/kubemacpool/conftest.py
  • tests/storage/cdi_import/conftest.py
  • tests/network/general/test_bridge_marker.py
  • tests/network/migration/test_migration.py
  • tests/network/bond/test_l2_bridge_over_bond.py
📚 Learning: 2025-09-02T11:16:59.950Z
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 1904
File: tests/conftest.py:589-593
Timestamp: 2025-09-02T11:16:59.950Z
Learning: In tests/conftest.py, for non-baremetal/PSI clusters in the nodes_active_nics fixture, the user prefers to populate the "occupied" field with actual physical NICs from node_physical_nics rather than leaving it empty, to provide downstream consumers with visibility into physical NIC inventory even when NMState isn't managing them.

Applied to files:

  • tests/network/connectivity/conftest.py
  • tests/conftest.py
  • tests/network/jumbo_frame/conftest.py
  • tests/network/general/test_cnv_tuning_regression.py
  • tests/network/kubemacpool/conftest.py
  • tests/storage/cdi_import/conftest.py
  • tests/network/general/test_bridge_marker.py
  • tests/network/localnet/conftest.py
  • tests/network/migration/test_migration.py
  • tests/network/bond/test_l2_bridge_over_bond.py
📚 Learning: 2025-08-28T12:30:40.692Z
Learnt from: servolkov
Repo: RedHatQE/openshift-virtualization-tests PR: 1776
File: tests/network/bgp/conftest.py:35-54
Timestamp: 2025-08-28T12:30:40.692Z
Learning: The BGP test suite in tests/network/bgp/ relies on session-scoped validation in tests/network/conftest.py via the network_sanity fixture's _verify_bgp() function, which validates required environment variables (VLAN_TAG, EXTERNAL_FRR_STATIC_IPV4, BGP_CLUSTER_DOMAIN_GROUP) before any BGP tests run, making individual fixture-level validation redundant.

Applied to files:

  • tests/network/connectivity/conftest.py
  • tests/conftest.py
  • tests/network/jumbo_frame/conftest.py
  • tests/network/general/test_cnv_tuning_regression.py
  • tests/storage/cdi_import/conftest.py
  • tests/network/general/test_bridge_marker.py
  • tests/network/localnet/conftest.py
  • tests/network/bond/test_l2_bridge_over_bond.py
📚 Learning: 2025-06-18T09:21:34.315Z
Learnt from: OhadRevah
Repo: RedHatQE/openshift-virtualization-tests PR: 1166
File: tests/observability/metrics/conftest.py:1065-1077
Timestamp: 2025-06-18T09:21:34.315Z
Learning: In tests/observability/metrics/conftest.py, when creating fixtures that modify shared Windows VM state (like changing nodeSelector), prefer using function scope rather than class scope to ensure ResourceEditor context managers properly restore the VM state after each test, maintaining test isolation while still reusing expensive Windows VM fixtures.

Applied to files:

  • tests/network/connectivity/conftest.py
  • tests/conftest.py
  • tests/network/jumbo_frame/conftest.py
  • tests/network/general/test_cnv_tuning_regression.py
  • tests/network/kubemacpool/conftest.py
  • tests/storage/cdi_import/conftest.py
  • tests/network/general/test_bridge_marker.py
  • tests/network/localnet/conftest.py
📚 Learning: 2025-10-08T07:16:46.347Z
Learnt from: HarshithaMS005
Repo: RedHatQE/openshift-virtualization-tests PR: 2027
File: tests/network/nmstate/test_connectivity_after_nmstate_changes.py:231-233
Timestamp: 2025-10-08T07:16:46.347Z
Learning: Network tests in the openshift-virtualization-tests repository have a sanity check in tests/network/conftest.py (around line 237) that validates len(hosts_common_available_ports) > 1 before tests run. This ensures multinic tests requiring hosts_common_available_ports[-2] won't encounter IndexError, making fixture-level guards redundant.

Applied to files:

  • tests/network/connectivity/conftest.py
  • tests/conftest.py
  • tests/network/jumbo_frame/conftest.py
  • tests/network/general/test_cnv_tuning_regression.py
  • tests/network/localnet/conftest.py
📚 Learning: 2025-09-29T20:33:51.007Z
Learnt from: dshchedr
Repo: RedHatQE/openshift-virtualization-tests PR: 1932
File: tests/virt/node/migration_and_maintenance/conftest.py:65-72
Timestamp: 2025-09-29T20:33:51.007Z
Learning: In tests/virt/node/migration_and_maintenance/conftest.py, the added_vm_cpu_limit fixture doesn't require ResourceEditor as a context manager because it's the final test to modify the vm_for_multifd_test VM before teardown, so restoration of CPU limits is unnecessary overhead as confirmed by maintainer dshchedr.

Applied to files:

  • tests/conftest.py
  • tests/network/localnet/conftest.py
📚 Learning: 2025-10-27T15:30:06.412Z
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 1904
File: tests/network/conftest.py:348-362
Timestamp: 2025-10-27T15:30:06.412Z
Learning: In tests/network/conftest.py, the _verify_nmstate_running_pods function currently runs unconditionally in network_sanity, but rnetser plans to implement marker-based conditional checking (following the pattern of _verify_dpdk, _verify_sriov, etc.) in a future PR after adding nmstate markers to the relevant tests.

Applied to files:

  • tests/conftest.py
  • tests/network/general/test_cnv_tuning_regression.py
  • tests/network/localnet/conftest.py
📚 Learning: 2025-08-04T15:27:14.175Z
Learnt from: OhadRevah
Repo: RedHatQE/openshift-virtualization-tests PR: 1166
File: tests/observability/metrics/conftest.py:1065-1082
Timestamp: 2025-08-04T15:27:14.175Z
Learning: In tests/observability/metrics/conftest.py, the `non_existent_node_windows_vm` fixture is used for tier3 Windows VM testing and must use Windows VMs rather than Linux VMs, even though it adds overhead, because it's specifically testing Windows VM status transition metrics as part of dedicated Windows VM test coverage.

Applied to files:

  • tests/conftest.py
📚 Learning: 2025-06-18T09:31:06.311Z
Learnt from: OhadRevah
Repo: RedHatQE/openshift-virtualization-tests PR: 1166
File: tests/observability/metrics/conftest.py:1065-1077
Timestamp: 2025-06-18T09:31:06.311Z
Learning: In tests/observability/metrics/conftest.py, ResourceEditor context managers automatically restore VM configuration when the context exits, including nodeSelector patches. The fixture pattern with `with ResourceEditor(patches={vm: {...}})` followed by `yield` properly restores the VM to its original state without requiring manual teardown logic.

Applied to files:

  • tests/conftest.py
📚 Learning: 2025-11-19T08:13:30.263Z
Learnt from: SamAlber
Repo: RedHatQE/openshift-virtualization-tests PR: 2507
File: tests/virt/node/general/test_vmi_reset.py:26-29
Timestamp: 2025-11-19T08:13:30.263Z
Learning: In the openshift-virtualization-tests repository, user SamAlber prefers not to define fixture dependencies by chaining fixtures (adding one fixture as a parameter to another). Instead, all fixture dependencies should be explicitly declared as parameters in the test method itself, relying on parameter order to control execution sequence.

Applied to files:

  • tests/conftest.py
📚 Learning: 2025-09-12T08:10:48.874Z
Learnt from: rlobillo
Repo: RedHatQE/openshift-virtualization-tests PR: 1984
File: tests/install_upgrade_operators/network_policy/test_network_policy_components.py:16-16
Timestamp: 2025-09-12T08:10:48.874Z
Learning: Network policy tests that create different types of pods (client pod, server pod, existing component pods) for connectivity testing can run on SNO, as they don't require multiple replicas of the same component to function properly.

Applied to files:

  • tests/conftest.py
  • tests/network/general/test_bridge_marker.py
  • tests/network/localnet/conftest.py
📚 Learning: 2025-09-29T19:05:24.987Z
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 0
File: :0-0
Timestamp: 2025-09-29T19:05:24.987Z
Learning: For PR #1904 test execution, the critical validation point is test_connectivity_over_migration_between_localnet_vms which should fail gracefully on cloud clusters but pass on bare-metal/PSI clusters, representing the core nmstate conditional logic functionality.

Applied to files:

  • tests/network/general/test_cnv_tuning_regression.py
  • tests/network/localnet/conftest.py
📚 Learning: 2025-09-07T13:16:32.011Z
Learnt from: qwang1
Repo: RedHatQE/openshift-virtualization-tests PR: 1678
File: utilities/oadp.py:1-5
Timestamp: 2025-09-07T13:16:32.011Z
Learning: In the openshift-virtualization-tests project utilities/oadp.py, DynamicClient instances are passed as parameters rather than created internally, so kubernetes.config import is not needed for client creation fallback patterns.

Applied to files:

  • tests/network/localnet/conftest.py
🧬 Code graph analysis (10)
tests/conftest.py (1)
utilities/network.py (3)
  • EthernetNetworkConfigurationPolicy (585-643)
  • create_sriov_node_policy (1077-1099)
  • network_device (973-1014)
tests/network/l2_bridge/conftest.py (1)
tests/conftest.py (1)
  • admin_client (305-309)
tests/network/jumbo_frame/conftest.py (2)
tests/conftest.py (1)
  • admin_client (305-309)
utilities/network.py (1)
  • network_device (973-1014)
tests/network/general/test_cnv_tuning_regression.py (3)
tests/conftest.py (2)
  • admin_client (305-309)
  • worker_node1 (1006-1008)
utilities/network.py (1)
  • network_device (973-1014)
utilities/infra.py (1)
  • get_node_selector_dict (1149-1150)
tests/network/kubemacpool/conftest.py (1)
tests/conftest.py (1)
  • admin_client (305-309)
tests/storage/cdi_import/conftest.py (2)
tests/conftest.py (1)
  • admin_client (305-309)
utilities/network.py (1)
  • network_device (973-1014)
tests/network/general/test_bridge_marker.py (3)
tests/conftest.py (3)
  • admin_client (305-309)
  • worker_node1 (1006-1008)
  • worker_node2 (1012-1014)
utilities/network.py (1)
  • network_device (973-1014)
utilities/infra.py (1)
  • get_node_selector_dict (1149-1150)
utilities/network.py (1)
tests/network/user_defined_network/test_user_defined_network.py (1)
  • client (86-93)
tests/network/migration/test_migration.py (1)
tests/conftest.py (1)
  • admin_client (305-309)
tests/network/bond/test_l2_bridge_over_bond.py (1)
tests/conftest.py (1)
  • admin_client (305-309)
🪛 Ruff (0.14.7)
tests/conftest.py

1078-1078: Unused function argument: workers_utility_pods

(ARG001)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: build-container
  • GitHub Check: tox
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
🔇 Additional comments (14)
tests/network/l2_bridge/conftest.py (1)

55-69: Explicit admin_client wiring for bridge NNCPs looks correct

Both l2_bridge_device_worker_1 and _worker_2 now correctly take admin_client first and pass client=admin_client into network_device, aligning NNCP creation with cluster‑admin privileges. No further issues spotted here.

Also applies to: 74-88

tests/network/localnet/conftest.py (1)

43-63: Localnet NNCP/CUDN fixtures correctly enforce admin_client and jumbo MTU

nncp_localnet, the secondary‑NIC NNCP fixtures, and cudn_localnet_ovs_bridge_jumbo_frame all now take admin_client explicitly and pass client=admin_client (and mtu=cluster_hardware_mtu where relevant), which is consistent with the new NNCP/client contract. Looks good.

Also applies to: 361-385, 387-403

tests/network/connectivity/conftest.py (1)

37-52: Bridge NNCP connectivity fixtures now correctly use admin_client

All four nncp_*bridge* fixtures take admin_client as the first parameter and pass client=admin_client into network_device, which matches the new requirement for cluster‑wide NNCP operations. No issues found.

Also applies to: 55-70, 73-88, 91-106

tests/conftest.py (3)

963-983: IPv4-disable NNCP now correctly uses admin_client

worker_nodes_ipv4_false_secondary_nics explicitly takes admin_client and passes client=admin_client into EthernetNetworkConfigurationPolicy, which is appropriate for this cluster‑wide NNCP. Logic remains unchanged otherwise.


1685-1699: upgrade_bridge_on_all_nodes correctly requires admin_client

The upgrade_bridge_on_all_nodes fixture now requires admin_client and passes client=admin_client into network_device, ensuring the upgrade bridge NNCP is always applied with cluster‑admin privileges. Change is consistent with the rest of the PR.


1701-1711: bridge_on_one_node fixture aligned with explicit admin_client pattern

bridge_on_one_node now takes admin_client first and passes client=admin_client into network_device, making this marker/upgrade bridge NNCP also explicitly admin‑scoped. No further concerns.

tests/network/bond/test_l2_bridge_over_bond.py (1)

41-58: Bond/bridge NNCP fixtures now properly use admin_client

The bond and bridge‑on‑bond fixtures consistently take admin_client and pass client=admin_client into BondNodeNetworkConfigurationPolicy and network_device, so BOND and bridge NNCPs are created with the correct cluster‑admin client. The pattern is coherent across worker 1/2; no issues seen.

Also applies to: 62-82, 86-105, 108-126

tests/storage/cdi_import/conftest.py (1)

49-56: CDI bridge_on_node now correctly uses admin_client

bridge_on_node takes admin_client and passes client=admin_client into network_device, so the underlying LINUX_BRIDGE NNCP is applied with cluster‑admin privileges as required by the updated API. Looks good.

tests/network/general/test_cnv_tuning_regression.py (1)

24-32: linux_bridge_device fixture correctly threads admin_client into NNCP

The linux_bridge_device fixture now requires admin_client and passes client=admin_client into network_device, ensuring the tuning NNCP is created with the proper cluster‑admin client. No other behavior changes introduced.

tests/network/kubemacpool/conftest.py (1)

21-35: LGTM! Explicit admin_client properly threaded through fixtures.

Both kubemacpool_bridge_device_worker_1 and kubemacpool_bridge_device_worker_2 fixtures now correctly accept admin_client as the first parameter and pass it to network_device calls. This ensures NNCP operations use admin privileges as required for cluster-wide resources.

Also applies to: 39-53

tests/network/jumbo_frame/conftest.py (1)

124-133: LGTM! Admin client correctly propagated to network device.

The linux_bridge_interface fixture now accepts admin_client as its first parameter and properly passes it through to the network_device call, ensuring admin-level operations for NNCP creation.

tests/network/migration/test_migration.py (1)

66-79: LGTM! Migration test fixtures properly updated with admin client.

Both bridge_worker_1 and bridge_worker_2 fixtures correctly accept admin_client as the first parameter and pass client=admin_client to their respective network_device calls. This ensures the bridge network configurations for migration tests use admin privileges.

Also applies to: 83-97

tests/network/general/test_bridge_marker.py (1)

107-114: LGTM! Bridge marker fixtures correctly updated.

Both bridge_device_on_all_nodes and non_homogenous_bridges fixtures properly accept admin_client as the first parameter and pass it to all network_device calls. The nested context managers in non_homogenous_bridges correctly thread the client through both bridge device creations.

Also applies to: 118-133

tests/network/jumbo_frame/test_bridge.py (1)

36-53: LGTM! Jumbo frame bridge fixtures properly updated with admin client.

Both jumbo_frame_bridge_device_worker_1 and jumbo_frame_bridge_device_worker_2 fixtures correctly accept admin_client as the first parameter and pass client=admin_client to their network_device calls. This ensures jumbo frame bridge configurations use admin privileges for NNCP operations.

Also applies to: 57-74

@Anatw
Copy link
Contributor Author

Anatw commented Dec 7, 2025

/verified

Tested on bm02-ibm
Cluster version is 4.21.0-ec.3
kubevirt-hyperconverged-operator.v4.21.0
iib: 1072960

All network tests:
openshift-virtualization-tests-runner/3794
PYTEST_PARAMS: -s -o log_cli=true -m tier2 --jira --tc=vlans:861,978,1138 tests/network
= 3 failed, 117 passed, 6 skipped, 30 deselected, 1 xfailed, 554 warnings, 14 errors, 2 quarantined in 18534.22s (5:08:54) =
failures are identical to execution on main on the same cluster - other than the KMP test failures. An additional PR was submitted and executed aganist successfully:
openshift-virtualization-tests-runner/3820
PYTEST_PARAMS: -s -o log_cli=true -m tier2 --jira --tc=vlans:861,978,1138 tests/network/kubemacpool/test_kubemacpool.py
======= 11 passed, 46 warnings in 1032.85s (0:17:12) ======

tests/virt/cluster/common_templates/windows/test_windows_custom_options.py
PYTEST_PARAMS: -s -o log_cli=true -m tier2 --jira --tc=vlans:861,978,1138 tests/virt/cluster/common_templates/windows/test_windows_custom_options.py
openshift-virtualization-tests-runner/3822
Result:
=========== 5 passed, 24 warnings in 1260.35s (0:21:00) ========

tests/install_upgrade_operators/must_gather/test_must_gather.py
PYTEST_PARAMS: -s --rhel-os-matrix=rhel-8-10 --windows-os-matrix=win-2022 --centos-os-matrix=centos-stream-9 --fedora-os-matrix=fedora-41 --pdbcls=IPython.terminal.debugger:TerminalPdb --tc-format=python --storage-class-matrix=ocs-storagecluster-ceph-rbd-virtualization --skip-deprecated-api-test --tc=vlans:861,978,1138 tests/install_upgrade_operators/must_gather/test_must_gather.py
Result:
====== 118 passed, 1 deselected, 8 warnings in 1439.67s (0:23:59) =======

tests/storage/cdi_import/test_import_http.py
PYTEST_PARAMS: -s -o log_cli=true -m tier2 --jira --tc=vlans:861,978,1138 tests/storage/cdi_import/test_import_http.py
openshift-virtualization-tests-runner/3823/
Result:
= 47 passed, 1 skipped, 6 deselected, 382 warnings, 2 errors, 3 quarantined in 4334.43s (1:12:14) =
(failures are not related to the changes made in this PR. Also verified this with the storage team).

  • Using the verification from 3 days ago - the merge conflict I solved was resolved locally in the mega-PR with all the branches, against which the verification was made (WIP: Client all test #2965).

@openshift-virtualization-qe-bot-3
Copy link
Contributor

@coderabbitai

Test execution plan request details

CRITICAL: You MUST respond with a review comment on the Files Changed tab, NOT as a regular PR comment.
If it cannot be on the 1st line of the 1st file, add it to any other changed file.

As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan.
You will create a change request comment on the 1st line of the 1st file in the pr with the test execution plan.
If you fail to run or post a comment, retry.

Analysis Requirements:

  1. Examine code changes in each modified file
  2. Identify affected code paths, functions, and classes
  3. Analyze pytest-specific elements: fixtures (scope, dependencies), parametrization, markers, conftest changes
  4. Trace test dependencies through imports, shared utilities, and fixture inheritance
  5. Detect new tests introduced in the PR

Your deliverable:
Your change request comment will be based on the following requirements:

Test Execution Plan

  • path/to/test_file.py - When the entire test file needs verification
  • path/to/test_file.py::TestClass::test_method - When specific test(s) needed
  • path/to/test_file.py::test_function - When specific test(s) needed
  • -m marker - When specific marker(s) can be used to cover multiple cases.

Guidelines:

  • Include only tests directly affected by the changes
  • Use a full file path only if ALL tests in that file require verification
  • Use file path + test name if only specific tests are needed
  • If a test marker can cover multiple files/tests, provide the marker
  • Balance coverage vs over-testing - Keep descriptions minimal
  • Do not add a follow-up comment in the PR, only the change request one

@coderabbitai
Copy link

coderabbitai bot commented Dec 7, 2025

Tip

For best results, initiate chat on the files or code changes.

@openshift-virtualization-qe-bot-3, I'll provide a comprehensive test execution plan for this PR. Based on the signature changes to NNCP-related fixtures and the admin_client parameter addition, here's the targeted testing approach:

Test Execution Plan

Network Tests (Primary Impact Area)

  • tests/network/bond/test_bond_modes.py - All fixtures updated with admin_client
  • tests/network/bond/test_l2_bridge_over_bond.py - Bond and bridge fixtures modified
  • tests/network/bgp/ - VLAN NNCP fixture signature changed
  • tests/network/connectivity/ - All bridge device fixtures updated
  • tests/network/dry_run/test_dry_run_kubemacpool.py - Bridge fixture modified
  • tests/network/general/test_bridge_marker.py - Bridge device fixtures updated
  • tests/network/general/test_cnv_tuning_regression.py - Linux bridge fixture changed
  • tests/network/jumbo_frame/test_bond.py - Jumbo frame fixtures updated
  • tests/network/jumbo_frame/test_bridge.py - Jumbo frame bridge fixtures modified
  • tests/network/kubemacpool/ - Bridge device fixtures updated
  • tests/network/l2_bridge/ - All bridge fixtures modified
  • tests/network/l2_bridge/test_bridge_nic_hot_plug.py - Hot plug fixtures updated
  • tests/network/localnet/ - NNCP localnet fixtures signature changed
  • tests/network/macspoof/ - Bridge device fixtures updated
  • tests/network/migration/test_migration.py - Bridge fixtures modified
  • tests/network/nmstate/test_connectivity_after_nmstate_changes.py - NMState fixtures updated

Infrastructure/Core Tests

  • tests/conftest.py - Session-scoped fixtures modified: sriov_node_policy, upgrade_bridge_on_all_nodes, bridge_on_one_node, worker_nodes_ipv4_false_secondary_nics

Storage Tests

  • tests/storage/cdi_import/ - Bridge fixture dependency updated

Virtualization Tests

  • tests/virt/cluster/common_templates/windows/test_windows_custom_options.py - Windows custom bridge fixture modified

Install/Upgrade Tests

  • tests/install_upgrade_operators/must_gather/test_must_gather.py - Must gather bridge fixture updated

Recommended Marker-Based Execution

  • -m "tier1 or tier2" for comprehensive network coverage across tests/network/

Verification Status

Note: User @Anatw has already successfully verified this PR with comprehensive test execution on cluster bm02-ibm (CNV 4.21.0-ec.3):

  • Network tests: 117 passed (failures identical to main baseline)
  • Windows custom options: 5 passed
  • Must gather: 118 passed
  • CDI import: 47 passed

The verification covers all primary impact areas. Any additional testing should focus on edge cases or environments not covered in the initial verification.


🧠 Learnings used
Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 2469
File: utilities/sanity.py:139-142
Timestamp: 2025-11-08T07:36:57.616Z
Learning: In the openshift-virtualization-tests repository, user rnetser prefers to keep refactoring PRs (like PR #2469) strictly focused on moving/organizing code into more granular modules without adding new functionality, error handling, or behavioral changes. Such improvements should be handled in separate PRs.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 1028
File: utilities/infra.py:1249-1254
Timestamp: 2025-08-06T13:57:51.928Z
Learning: User rnetser verified that all calls to get_infrastructure() function use the admin_client parameter, confirming that signature changes requiring this parameter don't cause breaking changes in the openshift-virtualization-tests codebase.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 0
File: :0-0
Timestamp: 2025-09-29T19:05:24.987Z
Learning: For PR #1904 test execution, the critical validation point is test_connectivity_over_migration_between_localnet_vms which should fail gracefully on cloud clusters but pass on bare-metal/PSI clusters, representing the core nmstate conditional logic functionality.

Learnt from: vsibirsk
Repo: RedHatQE/openshift-virtualization-tests PR: 2045
File: tests/virt/cluster/vm_lifecycle/conftest.py:46-47
Timestamp: 2025-09-15T06:49:53.478Z
Learning: In the openshift-virtualization-tests repo, large fixture refactoring efforts like the golden image data source migration are handled incrementally by directory/team ownership. The virt/cluster directory is handled separately from virt/node, tests/infra, tests/storage, etc., with each area managed by relevant teams in follow-up PRs.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 0
File: :0-0
Timestamp: 2025-09-29T19:05:24.987Z
Learning: The test execution plan for PR #1904 focuses on cluster-type conditional logic where nmstate functionality is bypassed on cloud clusters (Azure/AWS) but fully functional on bare-metal/PSI clusters, requiring different test strategies for each environment type.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 1168
File: tests/storage/storage_migration/utils.py:92-99
Timestamp: 2025-06-10T09:41:58.035Z
Learning: When CodeRabbit flags technical issues in code reviews, do not resolve the comments without first addressing them and getting a response from the user. Proper procedure is to discuss the technical issues and proposed solutions before marking comments as resolved.

Learnt from: servolkov
Repo: RedHatQE/openshift-virtualization-tests PR: 1776
File: libs/net/node_network.py:25-31
Timestamp: 2025-08-20T23:43:28.117Z
Learning: In the RedHatQE/openshift-virtualization-tests project, servolkov's team always uses bare metal (BM) clusters with IPv4 setup in their testing environment, making defensive checks for IPv4 data presence potentially redundant in their networking code.

Learnt from: jpeimer
Repo: RedHatQE/openshift-virtualization-tests PR: 1160
File: tests/storage/storage_migration/test_mtc_storage_class_migration.py:165-176
Timestamp: 2025-06-17T07:45:37.776Z
Learning: In the openshift-virtualization-tests repository, user jpeimer prefers explicit fixture parameters over composite fixtures in test methods, even when there are many parameters, as they find this approach more readable and maintainable for understanding test dependencies.

Learnt from: akri3i
Repo: RedHatQE/openshift-virtualization-tests PR: 1210
File: tests/virt/cluster/general/mass_machine_type_transition_tests/conftest.py:24-64
Timestamp: 2025-06-23T19:28:20.281Z
Learning: In OpenShift Virtualization mass machine type transition tests, the machine type glob pattern "pc-q35-rhel8.*.*" is intentionally hard-coded in the kubevirt_api_lifecycle_automation_job as it's used only once for this specific test case, with plans to update it in the future if the job needs to support other machine types.

Learnt from: RoniKishner
Repo: RedHatQE/openshift-virtualization-tests PR: 1411
File: utilities/os_utils.py:246-279
Timestamp: 2025-07-22T17:13:59.166Z
Learning: In the RedHatQE/openshift-virtualization-tests repository, CentOS preferences follow the format "centos-stream<version>" (e.g., "centos-stream9", "centos-stream10"). The generate_instance_type_centos_os_matrix function correctly uses regex to extract numeric versions and constructs the latest version string in the same format as the input preferences for proper comparison.

Learnt from: akri3i
Repo: RedHatQE/openshift-virtualization-tests PR: 1210
File: tests/virt/cluster/general/mass_machine_type_transition_tests/conftest.py:83-97
Timestamp: 2025-06-23T19:19:31.961Z
Learning: In OpenShift Virtualization mass machine type transition tests, the kubevirt_api_lifecycle_automation_job requires cluster-admin privileges to function properly, as confirmed by the test maintainer akri3i.

Learnt from: yossisegev
Repo: RedHatQE/openshift-virtualization-tests PR: 0
File: :0-0
Timestamp: 2025-12-07T14:51:53.460Z
Learning: In the openshift-virtualization-tests repository, the team has decided to avoid using predefined time constants (like TIMEOUT_2MIN, TIMEOUT_5SEC) and prefers using explicit numeric values for timeout parameters.

Learnt from: vamsikrishna-siddu
Repo: RedHatQE/openshift-virtualization-tests PR: 2199
File: tests/storage/test_online_resize.py:108-113
Timestamp: 2025-09-28T14:43:07.181Z
Learning: In the openshift-virtualization-tests repo, PR #2199 depends on PR #2139 which adds architecture-specific OS_FLAVOR attributes to the Images.Cirros class (OS_FLAVOR_CIRROS for x86_64/ARM64, OS_FLAVOR_FEDORA for s390x), enabling conditional logic based on the underlying OS flavor in tests.

Learnt from: dshchedr
Repo: RedHatQE/openshift-virtualization-tests PR: 1716
File: tests/virt/conftest.py:289-297
Timestamp: 2025-08-09T01:52:26.683Z
Learning: When user dshchedr moves working code from one location to another in the openshift-virtualization-tests repository, they prefer not to modify it unless there's a real issue, maintaining the original implementation to avoid introducing unnecessary changes.

Learnt from: rnetser
Repo: RedHatQE/openshift-virtualization-tests PR: 2701
File: .github/scripts/coderabbit_workflow.py:45-46
Timestamp: 2025-11-27T11:45:54.224Z
Learning: In the openshift-virtualization-tests repository, when using the PyGithub library or similar API clients, rnetser prefers to rely on API-level validation rather than adding redundant client-side input validation, since the API will handle validation and raise appropriate errors.

Copy link
Contributor

@EdDev EdDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

/approve

@rnetser
Copy link
Collaborator

rnetser commented Dec 8, 2025

/approve
/lgtm

@rnetser rnetser merged commit abfa5f8 into RedHatQE:main Dec 8, 2025
24 of 25 checks passed
@openshift-virtualization-qe-bot

Successfully removed PR tag: quay.io/openshift-cnv/openshift-virtualization-tests:pr-2936.

@openshift-virtualization-qe-bot

New container for quay.io/openshift-cnv/openshift-virtualization-tests:latest published

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants