Skip to content

Conversation

@Anatw
Copy link
Contributor

@Anatw Anatw commented Dec 2, 2025

Short description:

Updated all OCP wrapper class instantiations across the network segment with the relevant client parameter.

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.

The choice between admin_client and unprivileged_client follows a clear principle based on the type of resource being accessed and the test scenario being validated:
admin_client is used for cluster-level infrastructure and operator-managed resources that require cluster-admin privileges.
unprivileged_client is used for user-created resources and scenarios that simulate real user workflows. Using unprivileged_client follows the principle of using the least privilege user possible.

jira-ticket:

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

Summary by CodeRabbit

  • Tests

    • Standardized client usage in test fixtures and helpers, switching several fixtures and tests to use explicit admin or unprivileged clients and updating service lookup behavior (now raises when missing).
  • Refactor

    • Test infrastructure updated to support admin and unprivileged client contexts broadly, improving consistency and isolation for network and VM-related tests.

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

@coderabbitai
Copy link

coderabbitai bot commented Dec 2, 2025

Walkthrough

Multiple test fixtures and utility functions were updated to accept and forward explicit Kubernetes client fixtures (admin_client or unprivileged_client) into resource constructors and helper calls across the network test suite.

Changes

Cohort / File(s) Summary
Root conftest & NodeNetworkState usages
tests/conftest.py
Added admin_client parameter to fixtures (nodes_active_nics, sriov_namespace, mac_pool, kmp_deployment) and pass client=admin_client to resource constructors (e.g., NodeNetworkState, Namespace, ConfigMap, Deployment).
Network conftest fixtures
tests/network/conftest.py
Added admin_client parameter to cluster_network_mtu and network_operator fixtures and construct Network/other resources with client=admin_client; updated sanity checks to construct PerformanceProfile and Namespace with the admin client.
Service exposure test
tests/network/general/test_ip_family_services.py
Changed virtctl_expose_service fixture signature to accept unprivileged_client and call get_service(..., client=unprivileged_client) (client param switched from admin to unprivileged).
kubemacpool fixtures
tests/network/kubemacpool/conftest.py
Injected unprivileged_client into disabled_ns_vm, enabled_ns_vm, no_label_ns_vm fixtures and pass client=unprivileged_client to VirtualMachineForTests.
kubemacpool test
tests/network/kubemacpool/test_kubemacpool.py
Updated test_kmp_down to accept unprivileged_client and create VM with client=unprivileged_client.
Upgrade utils
tests/network/upgrade/utils.py
assert_nmstate_bridge_creation now constructs NodeNetworkState with client= argument when checking for interface existence.
Network utilities
tests/network/utils.py
wait_for_address_on_iface uses named name/client when constructing NodeNetworkState; get_service signature changed to get_service(name, namespace, client) and now constructs Service(..., client=client), raising ResourceNotFoundError if missing.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Pattern is repetitive parameter addition and propagation with little to no logic change.
  • Review focus areas:
    • Verify fixture dependency wiring (no missing fixtures or ordering issues).
    • Confirm get_service signature change doesn't break callers.
    • Check NodeNetworkState/Service/VirtualMachineForTests constructors accept client= as used.

Possibly related PRs

Suggested labels

verified, can-be-merged, lgtm-rnetser, lgtm-servolkov, commented-coderabbitai[bot]

Suggested reviewers

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

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% 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 accurately reflects the primary change: mandating client parameters for OCP wrapper class instantiations across network tests.
Description check ✅ Passed The PR description covers short summary, motivation, implementation principle, and includes a JIRA ticket link; however, it lacks 'Which issue(s) this PR fixes' and 'Special notes for reviewer' sections from the template.
✨ 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

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
  • myakove
  • rnetser
  • vsibirsk

Reviewers:

  • Anatw
  • EdDev
  • RoniKishner
  • azhivovk
  • dshchedr
  • hmeir
  • rlobillo
  • rnetser
  • servolkov
  • 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.

@rnetser
Copy link
Collaborator

rnetser commented Dec 3, 2025

/lgtm

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.

The changes look fine to me.
Please elaborate about the different clients you used (admin vs unpriv). In the intention is explicit, future readers will understand why a specific client was used.

Updated all OCP wrapper class instantiations across the network segment
with the relevant client parameter.

The choice between admin_client and unprivileged_client follows a clear
principle based on the type of resource being accessed and the test
scenario being validated:
admin_client is used for cluster-level infrastructure and
operator-managed resources that require cluster-admin privileges.
unprivileged_client is used for user-created resources and scenarios
that simulate real user workflows. Using unprivileged_client follows the
principle of using the least privilege user possible.

Signed-off-by: Anat Wax <[email protected]>
@Anatw
Copy link
Contributor Author

Anatw commented Dec 7, 2025

Change: commit msg

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 (1)
tests/network/kubemacpool/test_kubemacpool.py (1)

131-134: Use kmp_down explicitly to satisfy Ruff while keeping fixture side effects

Passing unprivileged_client into VirtualMachineForTests here is aligned with the rest of the suite and keeps this negative test in an unprivileged context. The only issue is Ruff’s ARG001 about the unused kmp_down argument, since the fixture is relied on purely for its side effects.

You can keep the current behavior and silence the warning by explicitly “using” the fixture value:

 @pytest.mark.sno
 @pytest.mark.polarion("CNV-4405")
 @pytest.mark.single_nic
 @pytest.mark.s390x
 def test_kmp_down(unprivileged_client, namespace, kmp_down):
-    with pytest.raises(ApiException):
-        with VirtualMachineForTests(name="kmp-down-vm", namespace=namespace.name, client=unprivileged_client):
-            return
+    # kmp_down fixture is used for its side effects (scales KMP down)
+    _ = kmp_down
+
+    with pytest.raises(ApiException):
+        with VirtualMachineForTests(
+            name="kmp-down-vm",
+            namespace=namespace.name,
+            client=unprivileged_client,
+        ):
+            return

This keeps the fixture behavior unchanged while making the argument observably used for static analysis.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a1f49b6 and 29128c0.

📒 Files selected for processing (7)
  • tests/conftest.py (5 hunks)
  • tests/network/conftest.py (4 hunks)
  • tests/network/general/test_ip_family_services.py (2 hunks)
  • tests/network/kubemacpool/conftest.py (6 hunks)
  • tests/network/kubemacpool/test_kubemacpool.py (1 hunks)
  • tests/network/upgrade/utils.py (1 hunks)
  • tests/network/utils.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/conftest.py
  • tests/network/conftest.py
  • tests/network/general/test_ip_family_services.py
🧰 Additional context used
🧠 Learnings (12)
📓 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: 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.
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.
Learnt from: dshchedr
Repo: RedHatQE/openshift-virtualization-tests PR: 1716
File: tests/virt/node/workload_density/test_swap.py:71-85
Timestamp: 2025-08-09T01:46:48.039Z
Learning: In the openshift-virtualization-tests repository, user dshchedr prefers that all test setup fixtures be explicitly declared as parameters in the test method itself rather than chaining fixtures through dependencies. This makes all setup steps visible in one place at the test method level, improving test readability and making dependencies explicit, even if a fixture isn't directly used within another fixture's implementation.
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.
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.
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: 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.
Learnt from: azhivovk
Repo: RedHatQE/openshift-virtualization-tests PR: 2119
File: tests/network/localnet/conftest.py:352-366
Timestamp: 2025-10-31T13:05:24.570Z
Learning: In the RedHatQE/openshift-virtualization-tests repository, tests run sequentially by default on the same cluster (with module-scoped fixtures properly cleaned up between modules), and parallel test runs use different machines/clusters. This means cluster-scoped resources (like ClusterUserDefinedNetwork or NodeNetworkConfigurationPolicy) can safely use the same names across different test modules without risk of collision.
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: 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.
📚 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/upgrade/utils.py
  • tests/network/kubemacpool/conftest.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/kubemacpool/conftest.py
  • tests/network/kubemacpool/test_kubemacpool.py
📚 Learning: 2025-06-18T09:19:05.769Z
Learnt from: OhadRevah
Repo: RedHatQE/openshift-virtualization-tests PR: 1166
File: tests/observability/metrics/test_vms_metrics.py:129-137
Timestamp: 2025-06-18T09:19:05.769Z
Learning: For Windows VM testing in tests/observability/metrics/test_vms_metrics.py, it's acceptable to have more fixture parameters than typical pylint recommendations when reusing expensive Windows VM fixtures for performance. Windows VMs take a long time to deploy, so reusing fixtures like windows_vm_for_test and adding labels via windows_vm_with_low_bandwidth_migration_policy is preferred over creating separate fixtures that would require additional VM deployments.

Applied to files:

  • tests/network/kubemacpool/conftest.py
📚 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/kubemacpool/conftest.py
  • tests/network/utils.py
  • tests/network/kubemacpool/test_kubemacpool.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/network/kubemacpool/conftest.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/kubemacpool/conftest.py
📚 Learning: 2025-08-09T01:46:48.039Z
Learnt from: dshchedr
Repo: RedHatQE/openshift-virtualization-tests PR: 1716
File: tests/virt/node/workload_density/test_swap.py:71-85
Timestamp: 2025-08-09T01:46:48.039Z
Learning: In the openshift-virtualization-tests repository, user dshchedr prefers that all test setup fixtures be explicitly declared as parameters in the test method itself rather than chaining fixtures through dependencies. This makes all setup steps visible in one place at the test method level, improving test readability and making dependencies explicit, even if a fixture isn't directly used within another fixture's implementation.

Applied to files:

  • tests/network/kubemacpool/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/network/kubemacpool/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/kubemacpool/conftest.py
📚 Learning: 2025-06-23T19:19:31.961Z
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.

Applied to files:

  • tests/network/kubemacpool/conftest.py
  • tests/network/kubemacpool/test_kubemacpool.py
📚 Learning: 2025-09-08T22:06:55.755Z
Learnt from: dshchedr
Repo: RedHatQE/openshift-virtualization-tests PR: 1987
File: tests/virt/node/descheduler/conftest.py:165-170
Timestamp: 2025-09-08T22:06:55.755Z
Learning: In ocp-resources library, the .get() method expects the namespace object (not the string name) when passed as the namespace parameter, as confirmed in VirtualMachineInstanceMigration.get(dyn_client=admin_client, namespace=namespace) usage in tests/virt/node/descheduler/conftest.py.

Applied to files:

  • tests/network/utils.py
🧬 Code graph analysis (2)
tests/network/upgrade/utils.py (1)
utilities/infra.py (1)
  • get_node_selector_name (1145-1146)
tests/network/kubemacpool/conftest.py (1)
tests/conftest.py (1)
  • unprivileged_client (392-424)
🪛 Ruff (0.14.7)
tests/network/kubemacpool/test_kubemacpool.py

131-131: Unused function argument: kmp_down

(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). (17)
  • 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
  • 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
🔇 Additional comments (4)
tests/network/utils.py (2)

186-186: LGTM! NodeNetworkState now properly receives client parameter.

The addition of the client parameter to NodeNetworkState is consistent with the PR's objective to make client mandatory for OCP wrapper instantiations.


326-331: Verify all callers of get_service have been updated.

The function signature now requires a client parameter, which is a breaking change. All call sites across the network test suite must pass the new parameter to avoid runtime errors.

tests/network/upgrade/utils.py (1)

30-32: LGTM! NodeNetworkState now properly receives client parameter.

The addition of the client parameter to NodeNetworkState is consistent with the PR's objective to make client mandatory for OCP wrapper instantiations.

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

253-270: Client injection into kubemacpool VM fixtures is consistent and least‑privilege aligned

The updates to disabled_ns_vm, enabled_ns_vm, and no_label_ns_vm to accept unprivileged_client and pass client=unprivileged_client into VirtualMachineForTests look correct and consistent with the existing vm_a/vm_b fixtures. VM lifecycle and mac_pool cleanup behavior are preserved, while reserving admin_client for namespace/operator management and using unprivileged access for per‑namespace VMs, matching the PR’s client‑usage model.

Based on learnings, this follows the project pattern of passing client instances into helpers instead of constructing them internally.

Also applies to: 272-289, 291-307

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

@Anatw
Copy link
Contributor Author

Anatw commented Dec 7, 2025

/verified

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

All network test were executed:
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 main 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/network/upgrade/test_upgrade_network.py
PYTEST_PARAMS: -s -o log_cli=true -m tier2 --jira --tc=vlans:861,978,1138 -m upgrade --upgrade=cnv --cnv-image=NA --cnv-version=NA --skip-deprecated-api-test tests/network/upgrade/test_upgrade_network.py
openshift-virtualization-tests-runner/3821/
===== 8 passed, 8 skipped, 1 deselected, 31 warnings in 807.92s (0:13:27) ======

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
====== 118 passed, 1 deselected, 8 warnings in 1439.67s (0:23:59) =======

tests/infrastructure/sap/test_sap_hana_vm.py - As discussed with the infrastructure team, sap hana scenarios are currently not active, no need to run them as part of the verification.

  • I'm using the same verification from 3 days ago since only the commit msg has changed since.

@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 understand you're requesting a test execution plan to be posted as a review comment on the Files Changed tab. However, I'm unable to directly create review comments on specific lines in the Files Changed tab through my available interface - I can only post regular PR comments.

That said, I can provide the test execution plan here, and if needed, it can be manually posted as a review comment:

Test Execution Plan

Based on the fixture modifications in this PR, the following tests are affected:

Network Tests

  • tests/network/ - Full network test suite (uses nodes_active_nics, cluster_network_mtu, network_operator, sriov_namespace)

KubeMacPool Tests

  • tests/network/kubemacpool/test_kubemacpool.py - All tests (uses mac_pool, kmp_deployment, disabled_ns_vm, enabled_ns_vm, no_label_ns_vm fixtures)

Network Upgrade Tests

  • tests/network/upgrade/test_upgrade_network.py - All tests (uses mac_pool fixture and updated utility functions)

IP Family Services Tests

  • tests/network/general/test_ip_family_services.py - All tests (uses modified virtctl_expose_service fixture)

Must-Gather Tests

  • tests/install_upgrade_operators/must_gather/test_must_gather.py::TestMustGather::test_no_upstream_only_namespaces - Uses sriov_namespace fixture

Alternative Marker-Based Approach

  • -m tier2 - Can cover most network-related tests affected by these changes

Verification Status: ✅ COMPLETE

Per @Anatw's verification comments, all affected test areas have been successfully executed with passing results that match the main branch baseline.


🧠 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: 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.

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: 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: 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.

Learnt from: SiboWang1997
Repo: RedHatQE/openshift-virtualization-tests PR: 1566
File: tests/global_config_x86_64.py:29-29
Timestamp: 2025-07-25T01:59:02.180Z
Learning: In the openshift-virtualization-tests repo, the s390x architecture still relies on Fedora 41 images, while only x86_64 is updated to Fedora 42 in PR #1566.

@rnetser
Copy link
Collaborator

rnetser commented Dec 8, 2025

/approve
/lgtm

@rnetser rnetser merged commit eb61a2a into RedHatQE:main Dec 8, 2025
21 of 22 checks passed
@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.

8 participants