Skip to content

make client in migration tests mandatory#4994

Open
vsibirsk wants to merge 6 commits into
RedHatQE:mainfrom
vsibirsk:vk-migration-client
Open

make client in migration tests mandatory#4994
vsibirsk wants to merge 6 commits into
RedHatQE:mainfrom
vsibirsk:vk-migration-client

Conversation

@vsibirsk

@vsibirsk vsibirsk commented May 25, 2026

Copy link
Copy Markdown
Collaborator
What this PR does / why we need it:

modified migrate_vm_and_verify func client arg to be mandatory
and update relevant calls in functions and tests

Assisted-by: Cursor Agent (Composer 2.5)

Which issue(s) this PR fixes:

Aligns migration tests with default client deprecation in python-wrapper repo
https://redhat.atlassian.net/browse/CNV-68519

Special notes for reviewer:
jira-ticket:

https://redhat.atlassian.net/browse/CNV-88319

Summary by CodeRabbit

  • Tests

    • Updated live-migration, storage-migration, networking connectivity, and multi-VM migration tests/fixtures to pass an explicit admin client into migrate-and-verify workflows.
    • Improved test typing across many modules by using type-only imports and adding clearer fixture/test signatures and wiring (including fixture activation via usefixtures where applicable).
  • Refactor / Documentation

    • Updated the migrate-and-verify helper to require a non-optional client parameter and documented migration permission expectations more clearly.

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4f70f56c-5d3f-4174-b6f4-d41f26a255db

📥 Commits

Reviewing files that changed from the base of the PR and between b49268a and 88bfe5b.

📒 Files selected for processing (55)
  • tests/infrastructure/instance_types/supported_os/test_rhel_os.py
  • tests/infrastructure/instance_types/test_cpu_memory_hotplug_instancetype.py
  • tests/infrastructure/numa/conftest.py
  • tests/network/bgp/evpn/test_evpn_connectivity.py
  • tests/network/bgp/test_bgp_connectivity.py
  • tests/network/flat_overlay/conftest.py
  • tests/network/l2_bridge/rhel9_rhel10_cluster/test_connectivity.py
  • tests/network/l2_bridge/vmi_interfaces_stability/test_interfaces_stability.py
  • tests/network/libs/stuntime.py
  • tests/network/localnet/conftest.py
  • tests/network/localnet/test_default_bridge.py
  • tests/network/localnet/test_ovs_bridge.py
  • tests/network/migration/test_masquerade_connectivity_after_migration.py
  • tests/network/migration/test_migration.py
  • tests/network/service_mesh/test_service_mesh.py
  • tests/network/sriov/test_sriov.py
  • tests/network/user_defined_network/ip_specification/test_ip_specification.py
  • tests/network/user_defined_network/test_user_defined_network.py
  • tests/network/user_defined_network/test_user_defined_network_passt.py
  • tests/storage/cross_cluster_live_migration/test_cclm.py
  • tests/storage/cross_cluster_live_migration/utils.py
  • tests/storage/online_resize/test_online_resize.py
  • tests/storage/storage_migration/test_storage_class_migration.py
  • tests/storage/test_hotplug.py
  • tests/storage/upgrade/test_upgrade_storage.py
  • tests/virt/cluster/aaq/conftest.py
  • tests/virt/cluster/aaq/test_aaq_allocation_methods.py
  • tests/virt/cluster/aaq/test_arq.py
  • tests/virt/cluster/common_templates/centos/test_centos_os_support.py
  • tests/virt/cluster/common_templates/fedora/test_fedora_os_support.py
  • tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py
  • tests/virt/cluster/common_templates/rhel/test_rhel_tablet_device.py
  • tests/virt/cluster/common_templates/windows/test_windows_os_support.py
  • tests/virt/cluster/longevity_tests/test_multi_vm_multi_migration.py
  • tests/virt/cluster/longevity_tests/utils.py
  • tests/virt/cluster/migration_and_maintenance/test_migration_policy.py
  • tests/virt/cluster/sysprep/test_sysprep.py
  • tests/virt/cluster/vm_cloning/test_vm_cloning.py
  • tests/virt/cluster/vm_lifecycle/test_vm_run_strategy.py
  • tests/virt/node/general/test_machinetype.py
  • tests/virt/node/general/test_windows_vtpm_bitlocker.py
  • tests/virt/node/general/test_wsl2.py
  • tests/virt/node/high_performance_vm/test_isolate_emulator_thread.py
  • tests/virt/node/hotplug/test_cpu_memory_hotplug.py
  • tests/virt/node/log_verbosity/test_log_virt_launcher.py
  • tests/virt/node/migration_and_maintenance/test_odf_vm_migration.py
  • tests/virt/node/migration_and_maintenance/test_post_copy_migration.py
  • tests/virt/node/migration_and_maintenance/test_vm_disk_load_with_migration.py
  • tests/virt/node/migration_and_maintenance/test_vm_memory_load_with_migration.py
  • tests/virt/node/readonly_disk/test_vm_with_windows_guest_tools.py
  • tests/virt/node/workload_density/test_kernel_samepage_merging.py
  • tests/virt/node/workload_density/test_swap.py
  • tests/virt/upgrade/test_upgrade_virt.py
  • tests/virt/utils.py
  • utilities/virt.py

📝 Walkthrough

Walkthrough

This PR makes the client: DynamicClient parameter mandatory in migrate_vm_and_verify(), then systematically propagates this requirement through ~50 test files covering infrastructure, network, storage, and virt suites. The change enforces explicit cluster client context for all VM migration verification operations, improving authorization transparency and eliminating implicit client resolution patterns.

Changes

VM Migration Client Requirement Propagation

Layer / File(s) Summary
Core API contract change
utilities/virt.py
migrate_vm_and_verify signature changed from client: DynamicClient | None = None to client: DynamicClient (required). Docstring updated to document that only Cluster Admin can perform migrations; Namespace Admins require the kubevirt.io:migrate RoleBinding.
Helper function signatures
tests/virt/utils.py, tests/storage/cross_cluster_live_migration/utils.py, tests/virt/cluster/longevity_tests/utils.py
migrate_and_verify_multi_vms, verify_compute_live_migration_after_cclm, and run_migration_loop all accept and forward the mandatory client parameter to underlying migrate_vm_and_verify invocations.
Type annotation infrastructure
~50 test files
TYPE_CHECKING-guarded imports added to enable proper type hints for DynamicClient, VirtualMachineForTests, and migration-related types without runtime import overhead. from __future__ import annotations enables postponed evaluation.
Infrastructure instance types and NUMA
tests/infrastructure/instance_types/supported_os/test_rhel_os.py, tests/infrastructure/instance_types/test_cpu_memory_hotplug_instancetype.py, tests/infrastructure/numa/conftest.py
Test methods and fixtures accept admin_client with type annotations and forward it through migrate_vm_and_verify calls. Hotplug snapshot setup moved to @pytest.mark.usefixtures for ordering clarity.
Network connectivity: BGP, EVPN, flat overlay, L2 bridge
tests/network/bgp/evpn/test_evpn_connectivity.py, tests/network/bgp/test_bgp_connectivity.py, tests/network/flat_overlay/conftest.py, tests/network/l2_bridge/rhel9_rhel10_cluster/test_connectivity.py, tests/network/l2_bridge/vmi_interfaces_stability/test_interfaces_stability.py
Connectivity preservation tests add admin_client parameter while preserving active connection verification loops. Interface stability tests and docstring example updated to pass client.
Network isolation: localnet and migration
tests/network/localnet/conftest.py, tests/network/localnet/test_default_bridge.py, tests/network/localnet/test_ovs_bridge.py, tests/network/migration/test_masquerade_connectivity_after_migration.py, tests/network/migration/test_migration.py
Localnet fixtures and OVS/default bridge tests accept and forward admin_client. Network migration fixtures add admin_client parameter; masquerade and generic migration fixtures add generator return types for typed fixture returns and proper cleanup semantics.
Service mesh, SRIOV, UDN tests
tests/network/service_mesh/test_service_mesh.py, tests/network/sriov/test_sriov.py, tests/network/user_defined_network/test_user_defined_network.py, tests/network/user_defined_network/ip_specification/test_ip_specification.py, tests/network/user_defined_network/test_user_defined_network_passt.py
Network isolation, device passthrough, and UDN tests add admin_client parameter. UDN passt tests remove redundant passt_enabled_in_hco parameter while maintaining type safety.
Cross-cluster and storage class migration
tests/storage/cross_cluster_live_migration/test_cclm.py, tests/storage/cross_cluster_live_migration/utils.py, tests/storage/storage_migration/test_storage_class_migration.py
CCLM and storage class tests accept admin_client and forward it through both test-level and helper-level migration verification. Volume hotplug and Windows VTPM tests moved to @pytest.mark.usefixtures for setup ordering.
Storage online resize and hotplug
tests/storage/online_resize/test_online_resize.py, tests/storage/test_hotplug.py
Online resize and Windows/hotplug migration tests add admin_client parameter. Hotplug tests guard migration calls with is_dv_migratable() checks while forwarding client; bus/serial fixture setup moved to decorators.
Storage upgrade tests
tests/storage/upgrade/test_upgrade_storage.py
Post-upgrade hotplug test refactored to use @pytest.mark.usefixtures for hotplug_volume_upg and SSH connectivity fixtures while adding type annotations for admin_client, DataVolume, and VM parameters.
Virt cluster: AAQ and common templates
tests/virt/cluster/aaq/conftest.py, tests/virt/cluster/aaq/test_aaq_allocation_methods.py, tests/virt/cluster/aaq/test_arq.py, tests/virt/cluster/common_templates/*/test_*_os_support.py, tests/virt/cluster/common_templates/rhel/test_rhel_tablet_device.py
AAQ allocation and migration tests, plus common template OS support (CentOS, Fedora, RHEL, Windows) and tablet device tests all add admin_client parameter with type annotations and forward it through migration verification.
Virt cluster: policies and orchestration
tests/virt/cluster/migration_and_maintenance/test_migration_policy.py, tests/virt/cluster/sysprep/test_sysprep.py, tests/virt/cluster/vm_cloning/test_vm_cloning.py, tests/virt/cluster/vm_lifecycle/test_vm_run_strategy.py, tests/virt/cluster/longevity_tests/test_multi_vm_multi_migration.py, tests/virt/cluster/longevity_tests/utils.py
Migration policy (including re-migration after policy update), sysprep, VM cloning, run strategy, and longevity migration-storm tests all add admin_client parameter. Longevity test helper run_migration_loop propagates client through batch migration orchestration.
Virt node: general and performance
tests/virt/node/general/test_machinetype.py, tests/virt/node/general/test_windows_vtpm_bitlocker.py, tests/virt/node/general/test_wsl2.py, tests/virt/node/high_performance_vm/test_isolate_emulator_thread.py, tests/virt/node/hotplug/test_cpu_memory_hotplug.py
Machine type, VTPM/BitLocker, WSL2, emulator isolation, and hotplug snapshot tests add admin_client parameter. CPU/memory hotplug tests refactored to use @pytest.mark.usefixtures for snapshot setup.
Virt node: logging, ODF, post-copy
tests/virt/node/log_verbosity/test_log_virt_launcher.py, tests/virt/node/migration_and_maintenance/test_odf_vm_migration.py, tests/virt/node/migration_and_maintenance/test_post_copy_migration.py
Log verbosity fixture converted to typed generator that accepts admin_client and guarantees migration cleanup via try/finally. ODF and post-copy tests add admin_client parameter and forward it through migration verification.
Virt node: disk/memory load and workload density
tests/virt/node/migration_and_maintenance/test_vm_disk_load_with_migration.py, tests/virt/node/migration_and_maintenance/test_vm_memory_load_with_migration.py, tests/virt/node/workload_density/test_kernel_samepage_merging.py, tests/virt/node/workload_density/test_swap.py, tests/virt/node/readonly_disk/test_vm_with_windows_guest_tools.py
Disk load test refactored to use @pytest.mark.usefixtures for FIO fixture. Memory load, KSM, and swap tests add admin_client parameter. Swap test also refactors fixture wiring to use usefixtures for swap labeling and policy fixtures. Readonly disk guest-tools fixture adds typed admin_client parameter.
Virt upgrade
tests/virt/upgrade/test_upgrade_virt.py
Pre- and post-upgrade migration tests (post-copy and general) all add admin_client parameter. Post-copy before-upgrade test refactored to use @pytest.mark.usefixtures for migration policy fixture while adding type annotations across all upgrade paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Rationale: This is a high-volume but low-complexity refactoring with a highly repetitive pattern across ~50 test files: (1) add TYPE_CHECKING block with type-only imports, (2) add admin_client parameter to test/fixture signature with type annotation, (3) forward it to the single migrate_vm_and_verify call. The core API change is minimal (removing a default parameter value from one function). No logic density, novel algorithms, branching logic, or behavioral changes. Risk is low because the change uniformly propagates a single authorization requirement without altering test assertions or flow.

Possibly related PRs

  • RedHatQE/openshift-virtualization-tests#3847: Both PRs update the RHEL instance-types migration tests (tests/infrastructure/instance_types/supported_os/test_rhel_os.py) to thread an admin_client through the migration verification path (i.e., pass it into migrate_vm_and_verify/libvirt-domain validation).
  • RedHatQE/openshift-virtualization-tests#4916: The main PR updates multiple test functions/fixtures to thread admin_client into migrate_vm_and_verify via the explicit client=admin_client argument, matching the behavioral/API change from PR #4916 that removed implicit client usage.

Suggested reviewers

  • dshchedr
  • kbidarkar
  • RoniKishner
  • OhadRevah
  • SamAlber
  • albarker-rh
  • geetikakay
  • rnetser
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: making the client parameter mandatory in migration tests, which is the core objective of this PR.
Description check ✅ Passed The description covers all required sections: what the PR does, which issues it fixes, special notes for reviewer, and jira ticket with full URL.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stp Link Required ✅ Passed PR adds no new test files or test functions under tests/; all changes are modifications to existing test functions and fixtures (parameter additions, type annotations, function call updates). STP/R...

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Linked repositories: Your configuration references 1 linked repositories, but your current plan allows 0. Analyzed ``, skipped RedHatQE/openshift-virtualization-tests-design-docs.


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.

@codecov

codecov Bot commented May 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.65%. Comparing base (a2dc143) to head (88bfe5b).
⚠️ Report is 132 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4994      +/-   ##
==========================================
- Coverage   98.67%   98.65%   -0.02%     
==========================================
  Files          25       25              
  Lines        2487     2461      -26     
==========================================
- Hits         2454     2428      -26     
  Misses         33       33              
Flag Coverage Δ
utilities 98.65% <ø> (-0.02%) ⬇️

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

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

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

@openshift-virtualization-qe-bot

Copy link
Copy Markdown

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
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified
  • Labels: Enabled categories: branch, can-be-merged, cherry-pick, has-conflicts, hold, needs-rebase, size, verified, wip

📋 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)
  • /regenerate-welcome - Regenerate this welcome message

Review & Approval

  • /lgtm - Approve changes (looks good to me)
  • /approve - Approve PR (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 verify-bugs-are-open - verify-bugs-are-open
  • /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, has-conflicts labels and PR must be mergeable (no conflicts)
  5. Verified: PR must be marked as verified

📊 Review Process

Approvers and Reviewers

Approvers:

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

Reviewers:

  • Ahmad-Hafe
  • Anatw
  • EdDev
  • RoniKishner
  • SamAlber
  • acinko-rh
  • akri3i
  • azhivovk
  • dalia-frank
  • dshchedr
  • ema-aka-young
  • frenzyfriday
  • geetikakay
  • hmeir
  • josemacassan
  • jpeimer
  • kgoldbla
  • kshvaika
  • mijankow
  • nirdothan
  • orelmisan
  • rlobillo
  • rnetser
  • servolkov
  • vsibirsk
  • yossisegev
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
AI Features
  • Cherry-Pick Conflict Resolution: Enabled (claude/claude-opus-4-6[1m])

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is removed on new commits unless the push is detected as a clean rebase
  • 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/virt/node/log_verbosity/test_log_virt_launcher.py`:
- Around line 99-103: The migrated_vm_with_policy fixture relies on
`@pytest.mark.usefixtures` which does not guarantee execution order, risking
migration starting before the source pod is captured. Add
source_pod_log_verbosity_test as an explicit parameter to the
migrated_vm_with_policy function signature to create a hard dependency that
ensures the pod is captured before migration begins. Apply the same fix to the
other affected fixture location mentioned in the comment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 43ce4a43-ae16-49bb-a3a6-985eea34a064

📥 Commits

Reviewing files that changed from the base of the PR and between f9ca06a and afb317b.

📒 Files selected for processing (55)
  • tests/infrastructure/instance_types/supported_os/test_rhel_os.py
  • tests/infrastructure/instance_types/test_cpu_memory_hotplug_instancetype.py
  • tests/infrastructure/numa/conftest.py
  • tests/network/bgp/evpn/test_evpn_connectivity.py
  • tests/network/bgp/test_bgp_connectivity.py
  • tests/network/flat_overlay/conftest.py
  • tests/network/l2_bridge/rhel9_rhel10_cluster/test_connectivity.py
  • tests/network/l2_bridge/vmi_interfaces_stability/test_interfaces_stability.py
  • tests/network/libs/stuntime.py
  • tests/network/localnet/conftest.py
  • tests/network/localnet/test_default_bridge.py
  • tests/network/localnet/test_ovs_bridge.py
  • tests/network/migration/test_masquerade_connectivity_after_migration.py
  • tests/network/migration/test_migration.py
  • tests/network/service_mesh/test_service_mesh.py
  • tests/network/sriov/test_sriov.py
  • tests/network/user_defined_network/ip_specification/test_ip_specification.py
  • tests/network/user_defined_network/test_user_defined_network.py
  • tests/network/user_defined_network/test_user_defined_network_passt.py
  • tests/storage/cross_cluster_live_migration/test_cclm.py
  • tests/storage/cross_cluster_live_migration/utils.py
  • tests/storage/online_resize/test_online_resize.py
  • tests/storage/storage_migration/test_storage_class_migration.py
  • tests/storage/test_hotplug.py
  • tests/storage/upgrade/test_upgrade_storage.py
  • tests/virt/cluster/aaq/conftest.py
  • tests/virt/cluster/aaq/test_aaq_allocation_methods.py
  • tests/virt/cluster/aaq/test_arq.py
  • tests/virt/cluster/common_templates/centos/test_centos_os_support.py
  • tests/virt/cluster/common_templates/fedora/test_fedora_os_support.py
  • tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py
  • tests/virt/cluster/common_templates/rhel/test_rhel_tablet_device.py
  • tests/virt/cluster/common_templates/windows/test_windows_os_support.py
  • tests/virt/cluster/longevity_tests/test_multi_vm_multi_migration.py
  • tests/virt/cluster/longevity_tests/utils.py
  • tests/virt/cluster/migration_and_maintenance/test_migration_policy.py
  • tests/virt/cluster/sysprep/test_sysprep.py
  • tests/virt/cluster/vm_cloning/test_vm_cloning.py
  • tests/virt/cluster/vm_lifecycle/test_vm_run_strategy.py
  • tests/virt/node/general/test_machinetype.py
  • tests/virt/node/general/test_windows_vtpm_bitlocker.py
  • tests/virt/node/general/test_wsl2.py
  • tests/virt/node/high_performance_vm/test_isolate_emulator_thread.py
  • tests/virt/node/hotplug/test_cpu_memory_hotplug.py
  • tests/virt/node/log_verbosity/test_log_virt_launcher.py
  • tests/virt/node/migration_and_maintenance/test_odf_vm_migration.py
  • tests/virt/node/migration_and_maintenance/test_post_copy_migration.py
  • tests/virt/node/migration_and_maintenance/test_vm_disk_load_with_migration.py
  • tests/virt/node/migration_and_maintenance/test_vm_memory_load_with_migration.py
  • tests/virt/node/readonly_disk/test_vm_with_windows_guest_tools.py
  • tests/virt/node/workload_density/test_kernel_samepage_merging.py
  • tests/virt/node/workload_density/test_swap.py
  • tests/virt/upgrade/test_upgrade_virt.py
  • tests/virt/utils.py
  • utilities/virt.py

Comment thread tests/virt/node/log_verbosity/test_log_virt_launcher.py
Comment on lines +53 to +54
_L2_ENDPOINT_IPV4: str = f"{random_ipv4_address(net_seed=EVPN_CUDN_NET_SEED, host_address=249)}/24"
_L2_ENDPOINT_IPV6: str = f"{random_ipv6_address(net_seed=EVPN_CUDN_NET_SEED, host_address=249)}/64"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

moved by ruff?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

i did during merge conflict resolution. should it stay before pytestmark block?

@rnetser

rnetser commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

/retest security-committer-identity

1 similar comment
@rnetser

rnetser commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

/retest security-committer-identity

@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

/retest all

Auto-triggered: Files in this PR were modified by merged PR #4873.

Overlapping files

utilities/virt.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/network/bgp/evpn/test_evpn_connectivity.py`:
- Line 54: There is an unresolved review thread anchored on the line containing
the _L2_ENDPOINT_IPV6 variable definition that is blocking the merge. Locate
this unresolved comment thread in the pull request review interface, read the
specific concern or question that was raised in the conversation, provide a
substantive and thoughtful response that directly addresses the reviewer's
concern (whether by explaining the code choice, acknowledging the issue and
fixing it, or documenting why the current approach is appropriate), and then
mark the thread as resolved after your response has been posted.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ac949053-49a6-4e8d-8c25-6307e7f901bd

📥 Commits

Reviewing files that changed from the base of the PR and between afb317b and b49268a.

📒 Files selected for processing (55)
  • tests/infrastructure/instance_types/supported_os/test_rhel_os.py
  • tests/infrastructure/instance_types/test_cpu_memory_hotplug_instancetype.py
  • tests/infrastructure/numa/conftest.py
  • tests/network/bgp/evpn/test_evpn_connectivity.py
  • tests/network/bgp/test_bgp_connectivity.py
  • tests/network/flat_overlay/conftest.py
  • tests/network/l2_bridge/rhel9_rhel10_cluster/test_connectivity.py
  • tests/network/l2_bridge/vmi_interfaces_stability/test_interfaces_stability.py
  • tests/network/libs/stuntime.py
  • tests/network/localnet/conftest.py
  • tests/network/localnet/test_default_bridge.py
  • tests/network/localnet/test_ovs_bridge.py
  • tests/network/migration/test_masquerade_connectivity_after_migration.py
  • tests/network/migration/test_migration.py
  • tests/network/service_mesh/test_service_mesh.py
  • tests/network/sriov/test_sriov.py
  • tests/network/user_defined_network/ip_specification/test_ip_specification.py
  • tests/network/user_defined_network/test_user_defined_network.py
  • tests/network/user_defined_network/test_user_defined_network_passt.py
  • tests/storage/cross_cluster_live_migration/test_cclm.py
  • tests/storage/cross_cluster_live_migration/utils.py
  • tests/storage/online_resize/test_online_resize.py
  • tests/storage/storage_migration/test_storage_class_migration.py
  • tests/storage/test_hotplug.py
  • tests/storage/upgrade/test_upgrade_storage.py
  • tests/virt/cluster/aaq/conftest.py
  • tests/virt/cluster/aaq/test_aaq_allocation_methods.py
  • tests/virt/cluster/aaq/test_arq.py
  • tests/virt/cluster/common_templates/centos/test_centos_os_support.py
  • tests/virt/cluster/common_templates/fedora/test_fedora_os_support.py
  • tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py
  • tests/virt/cluster/common_templates/rhel/test_rhel_tablet_device.py
  • tests/virt/cluster/common_templates/windows/test_windows_os_support.py
  • tests/virt/cluster/longevity_tests/test_multi_vm_multi_migration.py
  • tests/virt/cluster/longevity_tests/utils.py
  • tests/virt/cluster/migration_and_maintenance/test_migration_policy.py
  • tests/virt/cluster/sysprep/test_sysprep.py
  • tests/virt/cluster/vm_cloning/test_vm_cloning.py
  • tests/virt/cluster/vm_lifecycle/test_vm_run_strategy.py
  • tests/virt/node/general/test_machinetype.py
  • tests/virt/node/general/test_windows_vtpm_bitlocker.py
  • tests/virt/node/general/test_wsl2.py
  • tests/virt/node/high_performance_vm/test_isolate_emulator_thread.py
  • tests/virt/node/hotplug/test_cpu_memory_hotplug.py
  • tests/virt/node/log_verbosity/test_log_virt_launcher.py
  • tests/virt/node/migration_and_maintenance/test_odf_vm_migration.py
  • tests/virt/node/migration_and_maintenance/test_post_copy_migration.py
  • tests/virt/node/migration_and_maintenance/test_vm_disk_load_with_migration.py
  • tests/virt/node/migration_and_maintenance/test_vm_memory_load_with_migration.py
  • tests/virt/node/readonly_disk/test_vm_with_windows_guest_tools.py
  • tests/virt/node/workload_density/test_kernel_samepage_merging.py
  • tests/virt/node/workload_density/test_swap.py
  • tests/virt/upgrade/test_upgrade_virt.py
  • tests/virt/utils.py
  • utilities/virt.py



_L2_ENDPOINT_IPV4: str = f"{random_ipv4_address(net_seed=EVPN_CUDN_NET_SEED, host_address=249)}/24"
_L2_ENDPOINT_IPV6: str = f"{random_ipv6_address(net_seed=EVPN_CUDN_NET_SEED, host_address=249)}/64"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

HIGH: Resolve the unresolved thread on this line to unblock merge.

can-be-merged is currently failing because a conversation anchored here is still unresolved. Please post a substantive in-thread response and re-resolve it.

As per coding guidelines, "NEVER merge a PR with known unresolved issues — fix or document them first."

🧰 Tools
🪛 GitHub Check: can-be-merged

[error] 54-54: PR has an unresolved review conversation at tests/network/bgp/evpn/test_evpn_connectivity.py:54

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/network/bgp/evpn/test_evpn_connectivity.py` at line 54, There is an
unresolved review thread anchored on the line containing the _L2_ENDPOINT_IPV6
variable definition that is blocking the merge. Locate this unresolved comment
thread in the pull request review interface, read the specific concern or
question that was raised in the conversation, provide a substantive and
thoughtful response that directly addresses the reviewer's concern (whether by
explaining the code choice, acknowledging the issue and fixing it, or
documenting why the current approach is appropriate), and then mark the thread
as resolved after your response has been posted.

Sources: Coding guidelines, Pipeline failures

@vsibirsk

Copy link
Copy Markdown
Collaborator Author

/verified

#4994 (comment)

@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

@coderabbitai

Test execution plan request details

CRITICAL: You MUST post an inline review comment on the first changed line of the first file.
The inline comment should contain the full Test Execution Plan (smoke decision, gating decision, and specific affected tests).
Do NOT submit a blocking review event (REQUEST_CHANGES/APPROVE).
Post a single inline PR comment on Files Changed (non-blocking COMMENT flow).

As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan.
You will post an inline review comment with the test execution plan on the first changed file.
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, fixture inheritance, fixture teardown, and yield from cleanup in conftest

  5. Detect new tests introduced in the PR

  6. Utilities and libs impact (when utilities/ or libs/ changes):
    You MUST use shell scripts (rg, git diff) to trace the full impact.
    Follow these sub-steps in order:

    6a. Identify modified symbols: For each changed file under utilities/ or libs/,
    list every modified function or method.
    Example: git diff HEAD~1 --unified=0 -- utilities/hco.py | grep '^[+-]def '

    6b. Find direct callers: Search tests and conftest for each symbol from 6a.
    Example: rg -l 'get_hco_version' tests/

    6c. Trace fixture teardown and cleanup: Find fixtures that reach
    the modified symbol through yield from or context-manager wrappers.
    Example: rg -l 'yield from.*enable_common_boot|def.*enable_common_boot' tests/

    6d. Trace same-file callers: In each changed file, find other functions
    whose body calls a modified symbol (including code after yield
    in @contextmanager helpers).
    Example: rg 'get_hco_version|enable_common_boot' utilities/hco.py

    6e. Expand transitively: If function A calls modified B, then
    tests/fixtures that call A are affected — even when the test body
    never imports B directly.

    Do NOT limit impact to tests that import the modified symbol only.

  7. Smoke test impact: Intersect the affected set from step 6 with smoke-marked tests.
    Run: rg -l '@pytest.mark.smoke' tests/
    VERIFY the above command returned actual file paths before concluding False.
    Set True if either condition is met:

    • a smoke-marked file appears in the affected set from 6b-6e, OR
    • any conftest.py in the smoke test's parent-directory hierarchy (up to repo root)
      imports or calls a modified utilities/libs symbol — including autouse fixtures
      that depend on modified functions. ALL tests in that directory and below are affected.
      Example check: for each smoke_file, scan dirname(smoke_file)/conftest.py,
      dirname(dirname(smoke_file))/conftest.py, etc. for modified symbol imports
      and autouse fixtures that depend on modified symbols.
  8. Gating test impact: Intersect the affected set from step 6 with gating-marked tests.
    Run: rg -l '@pytest.mark.gating' tests/
    Set True if a gating-marked file also appears in the affected set from 6b-6e.
    Utilities/libs changes often affect gating tests without affecting smoke tests.
    Do NOT stop analysis after concluding Run smoke tests: False.

Output rules:
Do NOT include analysis step numbers (1-8) in your visible output.

Your deliverable:
Your inline informational comment will be based on the following requirements:

Test Execution Plan

  • Run smoke tests: True / False — If True, state the dependency path (test → fixture → changed symbol). True ONLY with a verified path.
  • Run gating tests: True / False — If True, state the dependency path. True if any gating-marked test is in the affected set.
  • Affected tests to run (required when utilities/, libs/, or shared conftest changes — list concrete paths even when smoke is False)

Use these formats:

  • 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 a marker covers multiple affected tests (e.g. -m gating only if ALL gating tests in scope need run)
  • Tag each listed test or group with its marker when not obvious, e.g. (gating) or (smoke)

Real test commands (MANDATORY when changes affect session/runtime code):

When the affected code runs at session/collection time (conftest fixtures, pytest plugins,
config hooks, session-scoped setup) or modifies runtime behavior that unit tests mock away,
you MUST include concrete pytest commands the PR author must run on a real cluster
to verify the change works end-to-end. Include:

  • A command for the error/fix path (the scenario the PR fixes)
  • A command for the happy path (regression: the normal case still works)
  • Use lightweight tests (e.g., --collect-only for startup failures,
    a single small test for runtime behavior)
    If the PR only changes test logic (not utilities/libs/conftest), the affected test
    paths themselves serve as the real test commands — no separate section needed.

Example output for a session-startup fix:

**Real tests (cluster required)**
Error path (the fix):
`pytest tests/storage/.../test_foo.py --storage-class-matrix=nonexistent-sc --collect-only`
Expected: ValueError with clear message, not IndexError

Happy path (regression):
`pytest tests/storage/.../test_foo.py --storage-class-matrix=<valid-sc> -k test_bar`
Expected: session starts normally

Guidelines:

  • Include tests affected directly OR via fixture setup/teardown, yield from cleanup, or transitive utility call chains (caller calls modified helper)
  • Use a full file path only if ALL tests in that file require verification
  • Use file path + test name when only specific tests use an affected fixture or utility wrapper (preferred for partial file impact)
  • If a test marker can cover multiple files/tests, provide the marker
  • Balance coverage vs over-testing - Keep descriptions minimal
  • Example: if leaf helper foo() changes, include tests whose fixture teardown calls wrapper bar() where bar() calls foo(), even when the test body only imports an unrelated symbol from the same utilities module

Hardware-Related Checks (SR-IOV, GPU, DPDK):

When PR modifies fixtures for hardware-specific resources:

  • Collection Safety: Fixtures MUST have existence checks (return None when hardware unavailable)
  • Test Plan: MUST verify both WITH and WITHOUT hardware:
    • Run affected tests on cluster WITH hardware
    • Verify collection succeeds on cluster WITHOUT hardware

CRITICAL WORKFLOW COMPLETION RULES:

When responding to this test execution plan request, you MUST follow these rules EXACTLY:

  1. YOUR ONLY DELIVERABLE: Post one non-blocking inline comment containing the test execution plan on the first changed line
  2. THEN STOP IMMEDIATELY - Do NOT generate any additional response
  3. FALLBACK ONLY: If inline comment API calls fail after retrying, post as a regular PR comment
  4. SILENCE = SUCCESS: After successfully submitting the review, your task is complete. No confirmation needed.

ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):

  • ❌ Do NOT post acknowledgment messages like "Test execution plan posted", "Review posted successfully", "I've successfully posted"
  • ❌ Do NOT mention review IDs, URLs, or confirmation of posting in the PR thread
  • ❌ Do NOT add any follow-up comments after submitting the review
  • ❌ Do NOT reply to confirm task completion
  • ❌ Do NOT explain what you did - just do it and stop

Remember: The pull request review is visible to users. Additional comments are redundant noise.

CRITICAL — Verification rules for smoke and gating decisions:
- For each True decision, you must have traced a concrete path: test file → fixture → utility function → modified symbol.
- Do NOT assume impact based on scope, file proximity, or infrastructure-sounding names.
Only set True when you trace a concrete path through steps 6a-6e, then 7 or 8.
WRONG: "utilities/hco.py changed → run smoke" (no traced dependency path)
WRONG: "Run smoke tests: False" with no affected-test list when gating tests use the changed utility
RIGHT: "Run smoke tests: False, Run gating tests: True" plus tests/.../test_foo.py::TestBar::test_baz (gating)
RIGHT: "Smoke test X uses fixture Y → wrapper Z → changed function W in utilities/hco.py"

Comment thread tests/infrastructure/instance_types/supported_os/test_rhel_os.py
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Get current head SHA and first changed file
gh api repos/RedHatQE/openshift-virtualization-tests/pulls/4994 \
  --jq '{head_sha: .head.sha}'

echo ""
echo "=== FIRST FILE AND FIRST CHANGED LINE ==="
gh api repos/RedHatQE/openshift-virtualization-tests/pulls/4994/files \
  --jq '.[0] | {filename: .filename, patch: .patch}' | head -30

echo ""
echo "=== SMOKE MARKED FILES ==="
rg -l '`@pytest.mark.smoke`' tests/ --type py 2>/dev/null | head -20

echo ""
echo "=== GATING MARKED FILES THAT CALL migrate_vm_and_verify ==="
rg -l 'migrate_vm_and_verify' tests/ --type py | while read f; do
  if rg -q '`@pytest.mark.gating`' "$f" 2>/dev/null; then
    echo "$f"
  fi
done

Length of output: 3259


🏁 Script executed:

#!/bin/bash
BODY='## Test Execution Plan

**Run smoke tests: True**
Dependency path:
- `tests/infrastructure/instance_types/supported_os/test_rhel_os.py::TestVMMigrationAndState::test_migrate_vm` (smoke+gating) → calls `migrate_vm_and_verify(vm=..., client=admin_client, ...)` → `utilities/virt.py::migrate_vm_and_verify` (signature changed to mandatory `client: DynamicClient`)
- `tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py::TestCommonTemplatesRhel::test_migrate_vm` (smoke) → same call chain

**Run gating tests: True**
Dependency path: 11 gating-marked files directly call `migrate_vm_and_verify` with the now-mandatory `client` argument.

**Affected tests to run**

*(smoke)*
- `tests/infrastructure/instance_types/supported_os/test_rhel_os.py::TestVMMigrationAndState::test_migrate_vm` (smoke+gating)
- `tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py::TestCommonTemplatesRhel::test_migrate_vm` (smoke)

*(gating)*
- `tests/virt/upgrade/test_upgrade_virt.py` (gating)
- `tests/virt/node/general/test_machinetype.py` (gating)
- `tests/storage/test_hotplug.py` (gating)
- `tests/storage/online_resize/test_online_resize.py` (gating)
- `tests/virt/cluster/vm_cloning/test_vm_cloning.py` (gating)
- `tests/virt/cluster/vm_lifecycle/test_vm_run_strategy.py` (gating)
- `tests/network/localnet/test_default_bridge.py` (gating)
- `tests/virt/cluster/migration_and_maintenance/test_migration_policy.py` (gating)
- `tests/network/user_defined_network/test_user_defined_network.py` (gating)
- `tests/network/migration/test_masquerade_connectivity_after_migration.py` (gating)

*(other modified — no smoke/gating marker but directly affected)*
- `tests/infrastructure/instance_types/test_cpu_memory_hotplug_instancetype.py`
- `tests/infrastructure/numa/conftest.py`
- `tests/network/bgp/evpn/test_evpn_connectivity.py`
- `tests/network/bgp/test_bgp_connectivity.py`
- `tests/network/flat_overlay/conftest.py`
- `tests/network/l2_bridge/rhel9_rhel10_cluster/test_connectivity.py`
- `tests/network/l2_bridge/vmi_interfaces_stability/test_interfaces_stability.py`
- `tests/network/localnet/test_ovs_bridge.py`
- `tests/network/migration/test_migration.py`
- `tests/network/service_mesh/test_service_mesh.py`
- `tests/network/sriov/test_sriov.py`
- `tests/network/user_defined_network/ip_specification/test_ip_specification.py`
- `tests/network/user_defined_network/test_user_defined_network_passt.py`
- `tests/storage/cross_cluster_live_migration/test_cclm.py`
- `tests/storage/storage_migration/test_storage_class_migration.py`
- `tests/storage/upgrade/test_upgrade_storage.py`
- `tests/virt/cluster/aaq/test_aaq_allocation_methods.py`
- `tests/virt/cluster/aaq/test_arq.py`
- `tests/virt/cluster/common_templates/centos/test_centos_os_support.py`
- `tests/virt/cluster/common_templates/fedora/test_fedora_os_support.py`
- `tests/virt/cluster/common_templates/rhel/test_rhel_tablet_device.py`
- `tests/virt/cluster/common_templates/windows/test_windows_os_support.py`
- `tests/virt/cluster/longevity_tests/test_multi_vm_multi_migration.py`
- `tests/virt/cluster/sysprep/test_sysprep.py`
- `tests/virt/node/general/test_windows_vtpm_bitlocker.py`
- `tests/virt/node/general/test_wsl2.py`
- `tests/virt/node/high_performance_vm/test_isolate_emulator_thread.py`
- `tests/virt/node/hotplug/test_cpu_memory_hotplug.py`
- `tests/virt/node/log_verbosity/test_log_virt_launcher.py`
- `tests/virt/node/migration_and_maintenance/test_odf_vm_migration.py`
- `tests/virt/node/migration_and_maintenance/test_post_copy_migration.py`
- `tests/virt/node/migration_and_maintenance/test_vm_disk_load_with_migration.py`
- `tests/virt/node/migration_and_maintenance/test_vm_memory_load_with_migration.py`
- `tests/virt/node/readonly_disk/test_vm_with_windows_guest_tools.py`
- `tests/virt/node/workload_density/test_kernel_samepage_merging.py`
- `tests/virt/node/workload_density/test_swap.py`'

gh api repos/RedHatQE/openshift-virtualization-tests/pulls/4994/reviews \
  --method POST \
  --field commit_id="b49268ab4825c3a1dc6f2e9a8fce64754349762f" \
  --field event="COMMENT" \
  --field body="" \
  --field "comments[][path]=tests/infrastructure/instance_types/supported_os/test_rhel_os.py" \
  --field "comments[][position]=1" \
  --field "comments[][body]=$BODY"

Length of output: 6065



@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

/retest all

Auto-triggered: Files in this PR were modified by merged PR #5219.

Overlapping files

utilities/virt.py

@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

/retest all

Auto-triggered: Files in this PR were modified by merged PR #5167.

Overlapping files

tests/virt/upgrade/test_upgrade_virt.py

@vsibirsk

Copy link
Copy Markdown
Collaborator Author

/retest tox

@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

/retest all

Auto-triggered: Files in this PR were modified by merged PR #4810.

Overlapping files

tests/network/user_defined_network/ip_specification/test_ip_specification.py

vsibirsk added 5 commits June 18, 2026 13:16
Require an explicit DynamicClient for VM migration so callers must
choose the correct client (admin vs unprivileged). Update all fixtures,
helpers, and tests to pass client through to migrate_vm_and_verify.

Assisted-by: Cursor Agent (Composer 2.5)
Signed-off-by: vsibirsk <vsibirsk@redhat.com>
Move setup-only fixtures from test signatures to @pytest.mark.usefixtures
where the fixture return value is not used by the test body. Keeps test
parameters limited to resources the test actually inspects.

Assisted-by: Cursor Agent (Composer 2.5)
Signed-off-by: vsibirsk <vsibirsk@redhat.com>
Align modified fixtures with project rules to always return or yield
a value even when used only for setup.

Assisted-by: Cursor Agent (Composer 2.5)
Signed-off-by: vsibirsk <vsibirsk@redhat.com>
Annotate tests, fixtures, and helpers updated for mandatory client
with TYPE_CHECKING imports and parameter return types.

Assisted-by: Cursor Agent (Composer 2.5)
Signed-off-by: vsibirsk <vsibirsk@redhat.com>
Add from __future__ import annotations to modules that annotate
signatures with TYPE_CHECKING-only imports, preventing NameError when
annotations are evaluated at runtime.

Assisted-by: Cursor Agent (Composer 2.5)
Signed-off-by: vsibirsk <vsibirsk@redhat.com>
@vsibirsk

Copy link
Copy Markdown
Collaborator Author

/verified

#4994 (comment)

@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

@coderabbitai

Test execution plan request details

CRITICAL: You MUST post an inline review comment on the first changed line of the first file.
The inline comment should contain the full Test Execution Plan (smoke decision, gating decision, and specific affected tests).
Do NOT submit a blocking review event (REQUEST_CHANGES/APPROVE).
Post a single inline PR comment on Files Changed (non-blocking COMMENT flow).

As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan.
You will post an inline review comment with the test execution plan on the first changed file.
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, fixture inheritance, fixture teardown, and yield from cleanup in conftest

  5. Detect new tests introduced in the PR

  6. Utilities and libs impact (when utilities/ or libs/ changes):
    You MUST use shell scripts (rg, git diff) to trace the full impact.
    Follow these sub-steps in order:

    6a. Identify modified symbols: For each changed file under utilities/ or libs/,
    list every modified function or method.
    Example: git diff HEAD~1 --unified=0 -- utilities/hco.py | grep '^[+-]def '

    6b. Find direct callers: Search tests and conftest for each symbol from 6a.
    Example: rg -l 'get_hco_version' tests/

    6c. Trace fixture teardown and cleanup: Find fixtures that reach
    the modified symbol through yield from or context-manager wrappers.
    Example: rg -l 'yield from.*enable_common_boot|def.*enable_common_boot' tests/

    6d. Trace same-file callers: In each changed file, find other functions
    whose body calls a modified symbol (including code after yield
    in @contextmanager helpers).
    Example: rg 'get_hco_version|enable_common_boot' utilities/hco.py

    6e. Expand transitively: If function A calls modified B, then
    tests/fixtures that call A are affected — even when the test body
    never imports B directly.

    Do NOT limit impact to tests that import the modified symbol only.

  7. Smoke test impact: Intersect the affected set from step 6 with smoke-marked tests.
    Run: rg -l '@pytest.mark.smoke' tests/
    VERIFY the above command returned actual file paths before concluding False.
    Set True if either condition is met:

    • a smoke-marked file appears in the affected set from 6b-6e, OR
    • any conftest.py in the smoke test's parent-directory hierarchy (up to repo root)
      imports or calls a modified utilities/libs symbol — including autouse fixtures
      that depend on modified functions. ALL tests in that directory and below are affected.
      Example check: for each smoke_file, scan dirname(smoke_file)/conftest.py,
      dirname(dirname(smoke_file))/conftest.py, etc. for modified symbol imports
      and autouse fixtures that depend on modified symbols.
  8. Gating test impact: Intersect the affected set from step 6 with gating-marked tests.
    Run: rg -l '@pytest.mark.gating' tests/
    Set True if a gating-marked file also appears in the affected set from 6b-6e.
    Utilities/libs changes often affect gating tests without affecting smoke tests.
    Do NOT stop analysis after concluding Run smoke tests: False.

Output rules:
Do NOT include analysis step numbers (1-8) in your visible output.

Your deliverable:
Your inline informational comment will be based on the following requirements:

Test Execution Plan

  • Run smoke tests: True / False — If True, state the dependency path (test → fixture → changed symbol). True ONLY with a verified path.
  • Run gating tests: True / False — If True, state the dependency path. True if any gating-marked test is in the affected set.
  • Affected tests to run (required when utilities/, libs/, or shared conftest changes — list concrete paths even when smoke is False)

Use these formats:

  • 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 a marker covers multiple affected tests (e.g. -m gating only if ALL gating tests in scope need run)
  • Tag each listed test or group with its marker when not obvious, e.g. (gating) or (smoke)

Real test commands (MANDATORY when changes affect session/runtime code):

When the affected code runs at session/collection time (conftest fixtures, pytest plugins,
config hooks, session-scoped setup) or modifies runtime behavior that unit tests mock away,
you MUST include concrete pytest commands the PR author must run on a real cluster
to verify the change works end-to-end. Include:

  • A command for the error/fix path (the scenario the PR fixes)
  • A command for the happy path (regression: the normal case still works)
  • Use lightweight tests (e.g., --collect-only for startup failures,
    a single small test for runtime behavior)
    If the PR only changes test logic (not utilities/libs/conftest), the affected test
    paths themselves serve as the real test commands — no separate section needed.

Example output for a session-startup fix:

**Real tests (cluster required)**
Error path (the fix):
`pytest tests/storage/.../test_foo.py --storage-class-matrix=nonexistent-sc --collect-only`
Expected: ValueError with clear message, not IndexError

Happy path (regression):
`pytest tests/storage/.../test_foo.py --storage-class-matrix=<valid-sc> -k test_bar`
Expected: session starts normally

Guidelines:

  • Include tests affected directly OR via fixture setup/teardown, yield from cleanup, or transitive utility call chains (caller calls modified helper)
  • Use a full file path only if ALL tests in that file require verification
  • Use file path + test name when only specific tests use an affected fixture or utility wrapper (preferred for partial file impact)
  • If a test marker can cover multiple files/tests, provide the marker
  • Balance coverage vs over-testing - Keep descriptions minimal
  • Example: if leaf helper foo() changes, include tests whose fixture teardown calls wrapper bar() where bar() calls foo(), even when the test body only imports an unrelated symbol from the same utilities module

Hardware-Related Checks (SR-IOV, GPU, DPDK):

When PR modifies fixtures for hardware-specific resources:

  • Collection Safety: Fixtures MUST have existence checks (return None when hardware unavailable)
  • Test Plan: MUST verify both WITH and WITHOUT hardware:
    • Run affected tests on cluster WITH hardware
    • Verify collection succeeds on cluster WITHOUT hardware

CRITICAL WORKFLOW COMPLETION RULES:

When responding to this test execution plan request, you MUST follow these rules EXACTLY:

  1. YOUR ONLY DELIVERABLE: Post one non-blocking inline comment containing the test execution plan on the first changed line
  2. THEN STOP IMMEDIATELY - Do NOT generate any additional response
  3. FALLBACK ONLY: If inline comment API calls fail after retrying, post as a regular PR comment
  4. SILENCE = SUCCESS: After successfully submitting the review, your task is complete. No confirmation needed.

ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):

  • ❌ Do NOT post acknowledgment messages like "Test execution plan posted", "Review posted successfully", "I've successfully posted"
  • ❌ Do NOT mention review IDs, URLs, or confirmation of posting in the PR thread
  • ❌ Do NOT add any follow-up comments after submitting the review
  • ❌ Do NOT reply to confirm task completion
  • ❌ Do NOT explain what you did - just do it and stop

Remember: The pull request review is visible to users. Additional comments are redundant noise.

CRITICAL — Verification rules for smoke and gating decisions:
- For each True decision, you must have traced a concrete path: test file → fixture → utility function → modified symbol.
- Do NOT assume impact based on scope, file proximity, or infrastructure-sounding names.
Only set True when you trace a concrete path through steps 6a-6e, then 7 or 8.
WRONG: "utilities/hco.py changed → run smoke" (no traced dependency path)
WRONG: "Run smoke tests: False" with no affected-test list when gating tests use the changed utility
RIGHT: "Run smoke tests: False, Run gating tests: True" plus tests/.../test_foo.py::TestBar::test_baz (gating)
RIGHT: "Smoke test X uses fixture Y → wrapper Z → changed function W in utilities/hco.py"

Signed-off-by: vsibirsk <vsibirsk@redhat.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
tests/network/migration/test_migration.py (1)

294-303: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

HIGH: Ensure cleanup runs when setup fails before yield

At Line 294, migration is created with wait_for_migration_success=False, so cleanup is manual. If the wait loop fails before reaching yield, the cleanup at Line 303 is skipped, leaking migration resources. Use try/finally around wait+yield.

Suggested change
     migrated_vmi = migrate_vm_and_verify(vm=running_vmb, client=admin_client, wait_for_migration_success=False)
-    for sample in TimeoutSampler(
-        wait_timeout=TIMEOUT_1MIN,
-        sleep=1,
-        func=lambda: vmb_ip_before_migration != running_vmb.vmi.interfaces[0]["ipAddress"],
-    ):
-        if sample:
-            break
-    yield
-    migrated_vmi.clean_up()
+    try:
+        for sample in TimeoutSampler(
+            wait_timeout=TIMEOUT_1MIN,
+            sleep=1,
+            func=lambda: vmb_ip_before_migration != running_vmb.vmi.interfaces[0]["ipAddress"],
+        ):
+            if sample:
+                break
+        yield
+    finally:
+        migrated_vmi.clean_up()

As per coding guidelines: fixture cleanup must be reliable; guarding teardown with finally prevents resource leaks on setup exceptions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/network/migration/test_migration.py` around lines 294 - 303, The
fixture does not guarantee cleanup of the migrated_vmi resource if an exception
occurs during the wait loop before reaching the yield statement. Wrap the
TimeoutSampler loop and the yield statement in a try block, then place the
migrated_vmi.clean_up() call in a finally block to ensure cleanup always
executes regardless of whether exceptions occur during the wait loop or the
yield phase. This prevents resource leaks when the migration validation fails
before the fixture yields control to the test.

Source: Coding guidelines

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

68-84: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

HIGH: Make migration teardown exception-safe in fixture setup

At Line 68, migration starts with manual cleanup responsibility. If the IP-change wait fails before yield, the teardown at Line 84 never runs, leaving migration resources behind and making subsequent tests flaky. Wrap wait+yield in try/finally.

Suggested change
     migrated_vmi = migrate_vm_and_verify(
         vm=running_vm_for_migration, client=admin_client, wait_for_migration_success=False
     )
-
-    for sample in TimeoutSampler(
-        wait_timeout=60,
-        sleep=1,
-        func=lambda: (
-            ip_addresses_before
-            != lookup_iface_status(vm=running_vm_for_migration, iface_name=iface_name)["ipAddresses"]
-        ),
-    ):
-        if sample:
-            break
-
-    yield
-    migrated_vmi.clean_up()
+    try:
+        for sample in TimeoutSampler(
+            wait_timeout=60,
+            sleep=1,
+            func=lambda: (
+                ip_addresses_before
+                != lookup_iface_status(vm=running_vm_for_migration, iface_name=iface_name)["ipAddresses"]
+            ),
+        ):
+            if sample:
+                break
+
+        yield
+    finally:
+        migrated_vmi.clean_up()

As per coding guidelines: fixtures with cleanup must reliably execute cleanup code after yield; using finally preserves that behavior even on setup exceptions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/network/migration/test_masquerade_connectivity_after_migration.py`
around lines 68 - 84, The fixture lacks exception-safe teardown because if the
TimeoutSampler wait loop fails before yield, the migrated_vmi.clean_up() call at
the end never executes, leaving migration resources behind. Wrap the
migrate_vm_and_verify call and the TimeoutSampler loop in a try block, then move
the migrated_vmi.clean_up() call into a finally block to guarantee cleanup
always runs regardless of whether the wait succeeds or raises an exception.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/network/migration/test_masquerade_connectivity_after_migration.py`:
- Around line 66-67: Replace the dynamic interface lookup at line 66 where
iface_name is assigned from running_vm_for_migration.vmi.interfaces[0].name with
the hardcoded string 'default'. This ensures that the lookup_iface_status
function on line 67 consistently validates the masquerade interface regardless
of how the interfaces array gets ordered, making the test deterministic and
preventing false failures due to interface ordering changes.

In
`@tests/network/user_defined_network/ip_specification/test_ip_specification.py`:
- Around line 85-89: The assertions for guest IP specifications lack descriptive
failure messages, making it difficult to diagnose test failures in CI. Add a
descriptive message parameter to both assert statements (the one comparing
guest_ipv4 == ip_to_request around line 88-89 and the similar one around lines
170-174) that explicitly includes the expected value (ip_to_request) and actual
value (guest_ipv4) to provide clear context when the assertions fail.

In `@tests/virt/cluster/longevity_tests/utils.py`:
- Line 53: The type annotation for `vms_with_pids` on line 53 declares the inner
dictionary as `dict[str, VirtualMachineForTests]`, but the actual data structure
includes a "pid" key that holds a non-VM value (accessed at line 181 with
`["pid"]`). Update the type annotation to accurately reflect the actual payload
shape by modifying the inner dictionary type to account for both
VirtualMachineForTests objects and the pid value (such as using Union or a
TypedDict if available). Ensure the type hint matches how the structure is
actually used throughout the function to maintain static type checking
integrity.

In `@tests/virt/node/migration_and_maintenance/test_post_copy_migration.py`:
- Around line 93-101: The fixture drained_node_with_hotplugged_vm currently
performs setup work but returns None implicitly. Modify the fixture to yield the
hotplugged_vm resource after the drain_node context manager block, so that
dependent tests can access the prepared VM and fixture composition remains
explicit. This ensures the cleanup code in the context manager still executes
properly after the test completes.

In `@utilities/virt.py`:
- Around line 2216-2221: The pkill command with the pattern "oc adm drain" is
too broad and can kill unrelated drain operations from other tests running in
parallel. Instead of using the generic pattern-based pkill in the finally block,
capture the process ID (PID) when starting the nohup drain command and store it,
then use that specific PID with the kill command to terminate only the drain
process started for this particular node. This ensures that only the drain
process associated with this specific test cleanup is terminated, preventing
interference with concurrent tests.

---

Outside diff comments:
In `@tests/network/migration/test_masquerade_connectivity_after_migration.py`:
- Around line 68-84: The fixture lacks exception-safe teardown because if the
TimeoutSampler wait loop fails before yield, the migrated_vmi.clean_up() call at
the end never executes, leaving migration resources behind. Wrap the
migrate_vm_and_verify call and the TimeoutSampler loop in a try block, then move
the migrated_vmi.clean_up() call into a finally block to guarantee cleanup
always runs regardless of whether the wait succeeds or raises an exception.

In `@tests/network/migration/test_migration.py`:
- Around line 294-303: The fixture does not guarantee cleanup of the
migrated_vmi resource if an exception occurs during the wait loop before
reaching the yield statement. Wrap the TimeoutSampler loop and the yield
statement in a try block, then place the migrated_vmi.clean_up() call in a
finally block to ensure cleanup always executes regardless of whether exceptions
occur during the wait loop or the yield phase. This prevents resource leaks when
the migration validation fails before the fixture yields control to the test.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4f70f56c-5d3f-4174-b6f4-d41f26a255db

📥 Commits

Reviewing files that changed from the base of the PR and between b49268a and 88bfe5b.

📒 Files selected for processing (55)
  • tests/infrastructure/instance_types/supported_os/test_rhel_os.py
  • tests/infrastructure/instance_types/test_cpu_memory_hotplug_instancetype.py
  • tests/infrastructure/numa/conftest.py
  • tests/network/bgp/evpn/test_evpn_connectivity.py
  • tests/network/bgp/test_bgp_connectivity.py
  • tests/network/flat_overlay/conftest.py
  • tests/network/l2_bridge/rhel9_rhel10_cluster/test_connectivity.py
  • tests/network/l2_bridge/vmi_interfaces_stability/test_interfaces_stability.py
  • tests/network/libs/stuntime.py
  • tests/network/localnet/conftest.py
  • tests/network/localnet/test_default_bridge.py
  • tests/network/localnet/test_ovs_bridge.py
  • tests/network/migration/test_masquerade_connectivity_after_migration.py
  • tests/network/migration/test_migration.py
  • tests/network/service_mesh/test_service_mesh.py
  • tests/network/sriov/test_sriov.py
  • tests/network/user_defined_network/ip_specification/test_ip_specification.py
  • tests/network/user_defined_network/test_user_defined_network.py
  • tests/network/user_defined_network/test_user_defined_network_passt.py
  • tests/storage/cross_cluster_live_migration/test_cclm.py
  • tests/storage/cross_cluster_live_migration/utils.py
  • tests/storage/online_resize/test_online_resize.py
  • tests/storage/storage_migration/test_storage_class_migration.py
  • tests/storage/test_hotplug.py
  • tests/storage/upgrade/test_upgrade_storage.py
  • tests/virt/cluster/aaq/conftest.py
  • tests/virt/cluster/aaq/test_aaq_allocation_methods.py
  • tests/virt/cluster/aaq/test_arq.py
  • tests/virt/cluster/common_templates/centos/test_centos_os_support.py
  • tests/virt/cluster/common_templates/fedora/test_fedora_os_support.py
  • tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py
  • tests/virt/cluster/common_templates/rhel/test_rhel_tablet_device.py
  • tests/virt/cluster/common_templates/windows/test_windows_os_support.py
  • tests/virt/cluster/longevity_tests/test_multi_vm_multi_migration.py
  • tests/virt/cluster/longevity_tests/utils.py
  • tests/virt/cluster/migration_and_maintenance/test_migration_policy.py
  • tests/virt/cluster/sysprep/test_sysprep.py
  • tests/virt/cluster/vm_cloning/test_vm_cloning.py
  • tests/virt/cluster/vm_lifecycle/test_vm_run_strategy.py
  • tests/virt/node/general/test_machinetype.py
  • tests/virt/node/general/test_windows_vtpm_bitlocker.py
  • tests/virt/node/general/test_wsl2.py
  • tests/virt/node/high_performance_vm/test_isolate_emulator_thread.py
  • tests/virt/node/hotplug/test_cpu_memory_hotplug.py
  • tests/virt/node/log_verbosity/test_log_virt_launcher.py
  • tests/virt/node/migration_and_maintenance/test_odf_vm_migration.py
  • tests/virt/node/migration_and_maintenance/test_post_copy_migration.py
  • tests/virt/node/migration_and_maintenance/test_vm_disk_load_with_migration.py
  • tests/virt/node/migration_and_maintenance/test_vm_memory_load_with_migration.py
  • tests/virt/node/readonly_disk/test_vm_with_windows_guest_tools.py
  • tests/virt/node/workload_density/test_kernel_samepage_merging.py
  • tests/virt/node/workload_density/test_swap.py
  • tests/virt/upgrade/test_upgrade_virt.py
  • tests/virt/utils.py
  • utilities/virt.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
tests/network/migration/test_migration.py (1)

294-303: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

HIGH: Ensure cleanup runs when setup fails before yield

At Line 294, migration is created with wait_for_migration_success=False, so cleanup is manual. If the wait loop fails before reaching yield, the cleanup at Line 303 is skipped, leaking migration resources. Use try/finally around wait+yield.

Suggested change
     migrated_vmi = migrate_vm_and_verify(vm=running_vmb, client=admin_client, wait_for_migration_success=False)
-    for sample in TimeoutSampler(
-        wait_timeout=TIMEOUT_1MIN,
-        sleep=1,
-        func=lambda: vmb_ip_before_migration != running_vmb.vmi.interfaces[0]["ipAddress"],
-    ):
-        if sample:
-            break
-    yield
-    migrated_vmi.clean_up()
+    try:
+        for sample in TimeoutSampler(
+            wait_timeout=TIMEOUT_1MIN,
+            sleep=1,
+            func=lambda: vmb_ip_before_migration != running_vmb.vmi.interfaces[0]["ipAddress"],
+        ):
+            if sample:
+                break
+        yield
+    finally:
+        migrated_vmi.clean_up()

As per coding guidelines: fixture cleanup must be reliable; guarding teardown with finally prevents resource leaks on setup exceptions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/network/migration/test_migration.py` around lines 294 - 303, The
fixture does not guarantee cleanup of the migrated_vmi resource if an exception
occurs during the wait loop before reaching the yield statement. Wrap the
TimeoutSampler loop and the yield statement in a try block, then place the
migrated_vmi.clean_up() call in a finally block to ensure cleanup always
executes regardless of whether exceptions occur during the wait loop or the
yield phase. This prevents resource leaks when the migration validation fails
before the fixture yields control to the test.

Source: Coding guidelines

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

68-84: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

HIGH: Make migration teardown exception-safe in fixture setup

At Line 68, migration starts with manual cleanup responsibility. If the IP-change wait fails before yield, the teardown at Line 84 never runs, leaving migration resources behind and making subsequent tests flaky. Wrap wait+yield in try/finally.

Suggested change
     migrated_vmi = migrate_vm_and_verify(
         vm=running_vm_for_migration, client=admin_client, wait_for_migration_success=False
     )
-
-    for sample in TimeoutSampler(
-        wait_timeout=60,
-        sleep=1,
-        func=lambda: (
-            ip_addresses_before
-            != lookup_iface_status(vm=running_vm_for_migration, iface_name=iface_name)["ipAddresses"]
-        ),
-    ):
-        if sample:
-            break
-
-    yield
-    migrated_vmi.clean_up()
+    try:
+        for sample in TimeoutSampler(
+            wait_timeout=60,
+            sleep=1,
+            func=lambda: (
+                ip_addresses_before
+                != lookup_iface_status(vm=running_vm_for_migration, iface_name=iface_name)["ipAddresses"]
+            ),
+        ):
+            if sample:
+                break
+
+        yield
+    finally:
+        migrated_vmi.clean_up()

As per coding guidelines: fixtures with cleanup must reliably execute cleanup code after yield; using finally preserves that behavior even on setup exceptions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/network/migration/test_masquerade_connectivity_after_migration.py`
around lines 68 - 84, The fixture lacks exception-safe teardown because if the
TimeoutSampler wait loop fails before yield, the migrated_vmi.clean_up() call at
the end never executes, leaving migration resources behind. Wrap the
migrate_vm_and_verify call and the TimeoutSampler loop in a try block, then move
the migrated_vmi.clean_up() call into a finally block to guarantee cleanup
always runs regardless of whether the wait succeeds or raises an exception.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/network/migration/test_masquerade_connectivity_after_migration.py`:
- Around line 66-67: Replace the dynamic interface lookup at line 66 where
iface_name is assigned from running_vm_for_migration.vmi.interfaces[0].name with
the hardcoded string 'default'. This ensures that the lookup_iface_status
function on line 67 consistently validates the masquerade interface regardless
of how the interfaces array gets ordered, making the test deterministic and
preventing false failures due to interface ordering changes.

In
`@tests/network/user_defined_network/ip_specification/test_ip_specification.py`:
- Around line 85-89: The assertions for guest IP specifications lack descriptive
failure messages, making it difficult to diagnose test failures in CI. Add a
descriptive message parameter to both assert statements (the one comparing
guest_ipv4 == ip_to_request around line 88-89 and the similar one around lines
170-174) that explicitly includes the expected value (ip_to_request) and actual
value (guest_ipv4) to provide clear context when the assertions fail.

In `@tests/virt/cluster/longevity_tests/utils.py`:
- Line 53: The type annotation for `vms_with_pids` on line 53 declares the inner
dictionary as `dict[str, VirtualMachineForTests]`, but the actual data structure
includes a "pid" key that holds a non-VM value (accessed at line 181 with
`["pid"]`). Update the type annotation to accurately reflect the actual payload
shape by modifying the inner dictionary type to account for both
VirtualMachineForTests objects and the pid value (such as using Union or a
TypedDict if available). Ensure the type hint matches how the structure is
actually used throughout the function to maintain static type checking
integrity.

In `@tests/virt/node/migration_and_maintenance/test_post_copy_migration.py`:
- Around line 93-101: The fixture drained_node_with_hotplugged_vm currently
performs setup work but returns None implicitly. Modify the fixture to yield the
hotplugged_vm resource after the drain_node context manager block, so that
dependent tests can access the prepared VM and fixture composition remains
explicit. This ensures the cleanup code in the context manager still executes
properly after the test completes.

In `@utilities/virt.py`:
- Around line 2216-2221: The pkill command with the pattern "oc adm drain" is
too broad and can kill unrelated drain operations from other tests running in
parallel. Instead of using the generic pattern-based pkill in the finally block,
capture the process ID (PID) when starting the nohup drain command and store it,
then use that specific PID with the kill command to terminate only the drain
process started for this particular node. This ensures that only the drain
process associated with this specific test cleanup is terminated, preventing
interference with concurrent tests.

---

Outside diff comments:
In `@tests/network/migration/test_masquerade_connectivity_after_migration.py`:
- Around line 68-84: The fixture lacks exception-safe teardown because if the
TimeoutSampler wait loop fails before yield, the migrated_vmi.clean_up() call at
the end never executes, leaving migration resources behind. Wrap the
migrate_vm_and_verify call and the TimeoutSampler loop in a try block, then move
the migrated_vmi.clean_up() call into a finally block to guarantee cleanup
always runs regardless of whether the wait succeeds or raises an exception.

In `@tests/network/migration/test_migration.py`:
- Around line 294-303: The fixture does not guarantee cleanup of the
migrated_vmi resource if an exception occurs during the wait loop before
reaching the yield statement. Wrap the TimeoutSampler loop and the yield
statement in a try block, then place the migrated_vmi.clean_up() call in a
finally block to ensure cleanup always executes regardless of whether exceptions
occur during the wait loop or the yield phase. This prevents resource leaks when
the migration validation fails before the fixture yields control to the test.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4f70f56c-5d3f-4174-b6f4-d41f26a255db

📥 Commits

Reviewing files that changed from the base of the PR and between b49268a and 88bfe5b.

📒 Files selected for processing (55)
  • tests/infrastructure/instance_types/supported_os/test_rhel_os.py
  • tests/infrastructure/instance_types/test_cpu_memory_hotplug_instancetype.py
  • tests/infrastructure/numa/conftest.py
  • tests/network/bgp/evpn/test_evpn_connectivity.py
  • tests/network/bgp/test_bgp_connectivity.py
  • tests/network/flat_overlay/conftest.py
  • tests/network/l2_bridge/rhel9_rhel10_cluster/test_connectivity.py
  • tests/network/l2_bridge/vmi_interfaces_stability/test_interfaces_stability.py
  • tests/network/libs/stuntime.py
  • tests/network/localnet/conftest.py
  • tests/network/localnet/test_default_bridge.py
  • tests/network/localnet/test_ovs_bridge.py
  • tests/network/migration/test_masquerade_connectivity_after_migration.py
  • tests/network/migration/test_migration.py
  • tests/network/service_mesh/test_service_mesh.py
  • tests/network/sriov/test_sriov.py
  • tests/network/user_defined_network/ip_specification/test_ip_specification.py
  • tests/network/user_defined_network/test_user_defined_network.py
  • tests/network/user_defined_network/test_user_defined_network_passt.py
  • tests/storage/cross_cluster_live_migration/test_cclm.py
  • tests/storage/cross_cluster_live_migration/utils.py
  • tests/storage/online_resize/test_online_resize.py
  • tests/storage/storage_migration/test_storage_class_migration.py
  • tests/storage/test_hotplug.py
  • tests/storage/upgrade/test_upgrade_storage.py
  • tests/virt/cluster/aaq/conftest.py
  • tests/virt/cluster/aaq/test_aaq_allocation_methods.py
  • tests/virt/cluster/aaq/test_arq.py
  • tests/virt/cluster/common_templates/centos/test_centos_os_support.py
  • tests/virt/cluster/common_templates/fedora/test_fedora_os_support.py
  • tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py
  • tests/virt/cluster/common_templates/rhel/test_rhel_tablet_device.py
  • tests/virt/cluster/common_templates/windows/test_windows_os_support.py
  • tests/virt/cluster/longevity_tests/test_multi_vm_multi_migration.py
  • tests/virt/cluster/longevity_tests/utils.py
  • tests/virt/cluster/migration_and_maintenance/test_migration_policy.py
  • tests/virt/cluster/sysprep/test_sysprep.py
  • tests/virt/cluster/vm_cloning/test_vm_cloning.py
  • tests/virt/cluster/vm_lifecycle/test_vm_run_strategy.py
  • tests/virt/node/general/test_machinetype.py
  • tests/virt/node/general/test_windows_vtpm_bitlocker.py
  • tests/virt/node/general/test_wsl2.py
  • tests/virt/node/high_performance_vm/test_isolate_emulator_thread.py
  • tests/virt/node/hotplug/test_cpu_memory_hotplug.py
  • tests/virt/node/log_verbosity/test_log_virt_launcher.py
  • tests/virt/node/migration_and_maintenance/test_odf_vm_migration.py
  • tests/virt/node/migration_and_maintenance/test_post_copy_migration.py
  • tests/virt/node/migration_and_maintenance/test_vm_disk_load_with_migration.py
  • tests/virt/node/migration_and_maintenance/test_vm_memory_load_with_migration.py
  • tests/virt/node/readonly_disk/test_vm_with_windows_guest_tools.py
  • tests/virt/node/workload_density/test_kernel_samepage_merging.py
  • tests/virt/node/workload_density/test_swap.py
  • tests/virt/upgrade/test_upgrade_virt.py
  • tests/virt/utils.py
  • utilities/virt.py
📜 Review details
🔇 Additional comments (57)
tests/virt/cluster/aaq/conftest.py (1)

1-4: LGTM!

Also applies to: 47-49, 162-164

tests/virt/cluster/aaq/test_aaq_allocation_methods.py (1)

1-15: LGTM!

Also applies to: 51-54

tests/virt/cluster/aaq/test_arq.py (1)

1-4: LGTM!

Also applies to: 33-37, 124-127

tests/virt/cluster/common_templates/centos/test_centos_os_support.py (1)

5-8: LGTM!

Also applies to: 33-37, 139-141

tests/virt/cluster/common_templates/fedora/test_fedora_os_support.py (1)

5-8: LGTM!

Also applies to: 35-38, 215-218

tests/virt/cluster/vm_lifecycle/test_vm_run_strategy.py (1)

1-7: LGTM!

Also applies to: 22-25, 192-196, 314-322

tests/virt/cluster/longevity_tests/test_multi_vm_multi_migration.py (1)

1-4: LGTM!

Also applies to: 20-24, 40-48, 62-70, 84-93

tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py (1)

5-8: LGTM!

Also applies to: 36-40, 197-201

tests/virt/cluster/common_templates/rhel/test_rhel_tablet_device.py (1)

7-12: LGTM!

Also applies to: 24-26, 123-126

tests/virt/cluster/common_templates/windows/test_windows_os_support.py (1)

5-8: LGTM!

Also applies to: 31-35, 141-144

tests/virt/cluster/migration_and_maintenance/test_migration_policy.py (1)

1-4: LGTM!

Also applies to: 18-20, 108-127

tests/virt/cluster/sysprep/test_sysprep.py (1)

1-7: LGTM!

Also applies to: 26-27, 209-211

tests/virt/cluster/vm_cloning/test_vm_cloning.py (1)

1-4: LGTM!

Also applies to: 34-35, 304-305

tests/storage/cross_cluster_live_migration/test_cclm.py (1)

7-10: LGTM!

Also applies to: 25-29, 103-106, 156-159, 236-239

tests/storage/storage_migration/test_storage_class_migration.py (1)

1-4: LGTM!

Also applies to: 25-29, 87-94, 216-227, 327-339

tests/storage/online_resize/test_online_resize.py (1)

5-8: LGTM!

Also applies to: 26-30, 174-177

tests/storage/test_hotplug.py (1)

5-9: LGTM!

Also applies to: 35-37, 211-222, 256-263, 299-307

tests/storage/upgrade/test_upgrade_storage.py (1)

1-4: LGTM!

Also applies to: 27-32, 167-173, 182-182

tests/network/bgp/evpn/test_evpn_connectivity.py (1)

19-22: LGTM!

Also applies to: 38-47, 101-104, 118-118, 145-148, 162-162

tests/network/l2_bridge/rhel9_rhel10_cluster/test_connectivity.py (1)

11-14: LGTM!

Also applies to: 23-27, 43-46, 65-65, 75-78, 97-97

tests/network/l2_bridge/vmi_interfaces_stability/test_interfaces_stability.py (1)

1-3: LGTM!

Also applies to: 14-17, 31-37

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

401-406: LGTM!

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

1-5: LGTM!

Also applies to: 19-23, 25-37

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

1-5: LGTM!

Also applies to: 19-23, 25-35

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

1-5: LGTM!

Also applies to: 20-21

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

5-11: LGTM!

Also applies to: 45-47, 268-272

tests/network/bgp/test_bgp_connectivity.py (1)

1-14: LGTM!

Also applies to: 28-33

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

1-5: LGTM!

Also applies to: 33-37, 297-301

tests/network/service_mesh/test_service_mesh.py (1)

1-4: LGTM!

Also applies to: 15-19, 86-90

tests/network/sriov/test_sriov.py (1)

1-4: LGTM!

Also applies to: 15-20, 112-119

tests/network/user_defined_network/ip_specification/test_ip_specification.py (1)

10-29: LGTM!

Also applies to: 67-68, 105-105, 118-139

tests/network/user_defined_network/test_user_defined_network.py (1)

1-4: LGTM!

Also applies to: 17-21, 88-95, 121-124, 133-136

tests/network/user_defined_network/test_user_defined_network_passt.py (1)

1-4: LGTM!

Also applies to: 20-24, 91-114

utilities/virt.py (1)

1911-1955: LGTM!

Also applies to: 2677-2681

tests/virt/utils.py (1)

132-140: LGTM!

tests/storage/cross_cluster_live_migration/utils.py (1)

77-94: LGTM!

tests/virt/cluster/longevity_tests/utils.py (1)

1-39: LGTM!

tests/network/libs/stuntime.py (1)

31-31: LGTM!

tests/infrastructure/instance_types/supported_os/test_rhel_os.py (1)

1-4: LGTM!

Also applies to: 31-35, 145-152

tests/infrastructure/instance_types/test_cpu_memory_hotplug_instancetype.py (1)

1-4: LGTM!

Also applies to: 34-36, 142-146

tests/infrastructure/numa/conftest.py (1)

1-4: LGTM!

Also applies to: 16-17, 77-80

tests/virt/node/general/test_machinetype.py (1)

1-4: LGTM!

Also applies to: 29-31, 129-138

tests/virt/node/general/test_windows_vtpm_bitlocker.py (1)

1-5: LGTM!

Also applies to: 24-26, 130-134

tests/virt/node/general/test_wsl2.py (1)

6-11: LGTM!

Also applies to: 28-30, 122-124

tests/virt/node/high_performance_vm/test_isolate_emulator_thread.py (1)

5-8: LGTM!

Also applies to: 19-23, 92-95

tests/virt/node/hotplug/test_cpu_memory_hotplug.py (2)

1-4: LGTM!

Also applies to: 31-35


89-91: LGTM!

Also applies to: 146-148

tests/virt/node/log_verbosity/test_log_virt_launcher.py (1)

1-5: LGTM!

Also applies to: 21-25, 100-114, 138-144

tests/virt/node/migration_and_maintenance/test_odf_vm_migration.py (1)

1-16: LGTM!

Also applies to: 63-66

tests/virt/node/migration_and_maintenance/test_post_copy_migration.py (1)

1-38: LGTM!

Also applies to: 80-89

tests/virt/node/migration_and_maintenance/test_vm_disk_load_with_migration.py (1)

1-20: LGTM!

Also applies to: 103-106

tests/virt/node/migration_and_maintenance/test_vm_memory_load_with_migration.py (1)

1-4: LGTM!

Also applies to: 19-23, 48-53

tests/virt/node/readonly_disk/test_vm_with_windows_guest_tools.py (1)

1-4: LGTM!

Also applies to: 19-20, 109-114

tests/virt/node/workload_density/test_kernel_samepage_merging.py (1)

1-4: LGTM!

Also applies to: 17-21, 205-209

tests/virt/node/workload_density/test_swap.py (1)

1-5: LGTM!

Also applies to: 19-21, 195-202

tests/virt/upgrade/test_upgrade_virt.py (2)

1-4: LGTM!

Also applies to: 29-33, 142-149, 158-163, 278-283, 358-362


69-69: No action required. The fixture virt_launcher_images_from_csv_before_upgrade is correctly defined at tests/virt/upgrade/conftest.py:378 with session scope and is properly referenced throughout the codebase. No stale references exist.

🛑 Comments failed to post (5)
tests/network/migration/test_masquerade_connectivity_after_migration.py (1)

66-67: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

LOW: Pin the masquerade interface lookup to default

At Line 66, selecting interfaces[0] can drift when interface ordering changes, and then Line 67 may validate the wrong interface. Use the stable masquerade name directly to keep this test deterministic.

Suggested change
-    iface_name = running_vm_for_migration.vmi.interfaces[0].name
+    iface_name = "default"

Based on learnings: in tests under tests/network, prefer hardcoded interface name 'default' over vm.vmi.interfaces[0].name for masquerade migration checks.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/network/migration/test_masquerade_connectivity_after_migration.py`
around lines 66 - 67, Replace the dynamic interface lookup at line 66 where
iface_name is assigned from running_vm_for_migration.vmi.interfaces[0].name with
the hardcoded string 'default'. This ensures that the lookup_iface_status
function on line 67 consistently validates the masquerade interface regardless
of how the interfaces array gets ordered, making the test deterministic and
preventing false failures due to interface ordering changes.

Source: Learnings

tests/network/user_defined_network/ip_specification/test_ip_specification.py (1)

85-89: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

LOW: Add descriptive failure messages to the new guest-IP assertions.

These two new assertions make triage harder when they fail in CI because expected/actual values are not explicit in the assertion message.

Suggested patch
-        assert guest_ipv4 == ip_to_request
+        assert guest_ipv4 == ip_to_request, f"Guest IP mismatch: expected {ip_to_request}, got {guest_ipv4}"
...
-        assert guest_ipv4 == ip_to_request
+        assert guest_ipv4 == ip_to_request, f"Guest IP mismatch: expected {ip_to_request}, got {guest_ipv4}"

As per coding guidelines, tests should include descriptive assertion failure messages; based on learnings, this is expected for integration tests under tests/.

Also applies to: 170-174

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/network/user_defined_network/ip_specification/test_ip_specification.py`
around lines 85 - 89, The assertions for guest IP specifications lack
descriptive failure messages, making it difficult to diagnose test failures in
CI. Add a descriptive message parameter to both assert statements (the one
comparing guest_ipv4 == ip_to_request around line 88-89 and the similar one
around lines 170-174) that explicitly includes the expected value
(ip_to_request) and actual value (guest_ipv4) to provide clear context when the
assertions fail.

Sources: Coding guidelines, Learnings

tests/virt/cluster/longevity_tests/utils.py (1)

53-53: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

HIGH: vms_with_pids type annotation does not match actual payload shape

Line 53 declares dict[str, dict[str, VirtualMachineForTests]], but the same structure is read with a non-VM value at Line 181 (["pid"]). This weakens static checks and can mask contract regressions between migration and PID-verification paths.

Proposed fix
 from typing import TYPE_CHECKING
+from typing import TypedDict
 
 if TYPE_CHECKING:
     from kubernetes.dynamic import DynamicClient
 
+class VmMigrationEntry(TypedDict):
+    vm: VirtualMachineForTests
+    pid: int | str
+
 def run_migration_loop(
     client: DynamicClient,
     iterations: int,
-    vms_with_pids: dict[str, dict[str, VirtualMachineForTests]],
+    vms_with_pids: dict[str, VmMigrationEntry],
     os_type: str,
     wsl2_guest: bool = False,
 ) -> None:

As per coding guidelines, "Type hints are MANDATORY."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/virt/cluster/longevity_tests/utils.py` at line 53, The type annotation
for `vms_with_pids` on line 53 declares the inner dictionary as `dict[str,
VirtualMachineForTests]`, but the actual data structure includes a "pid" key
that holds a non-VM value (accessed at line 181 with `["pid"]`). Update the type
annotation to accurately reflect the actual payload shape by modifying the inner
dictionary type to account for both VirtualMachineForTests objects and the pid
value (such as using Union or a TypedDict if available). Ensure the type hint
matches how the structure is actually used throughout the function to maintain
static type checking integrity.

Source: Coding guidelines

tests/virt/node/migration_and_maintenance/test_post_copy_migration.py (1)

93-101: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

MEDIUM: Fixture should return or yield the provided resource

Line 93 defines a fixture that performs setup work but returns None. Returning (or yielding) the resource keeps fixture composition explicit and lets dependent tests inspect the prepared VM when needed.

Suggested fix
 `@pytest.fixture`()
 def drained_node_with_hotplugged_vm(admin_client, hco_namespace, compact_cluster, hotplugged_vm):
     with drain_node(
         admin_client=admin_client,
         node=hotplugged_vm.vmi.get_node(privileged_client=admin_client),
         hco_namespace=hco_namespace,
         compact_cluster=compact_cluster,
     ):
         check_migration_process_after_node_drain(client=admin_client, vm=hotplugged_vm, admin_client=admin_client)
     clean_up_migration_jobs(client=admin_client, vm=hotplugged_vm)
+    return hotplugged_vm

As per coding guidelines, “Fixtures should return/yield the resource even if it’s a setup fixture.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/virt/node/migration_and_maintenance/test_post_copy_migration.py` around
lines 93 - 101, The fixture drained_node_with_hotplugged_vm currently performs
setup work but returns None implicitly. Modify the fixture to yield the
hotplugged_vm resource after the drain_node context manager block, so that
dependent tests can access the prepared VM and fixture composition remains
explicit. This ensures the cleanup code in the context manager still executes
properly after the test completes.

Source: Coding guidelines

utilities/virt.py (1)

2216-2221: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

HIGH: Scope drain-process termination to avoid cross-test interference

Line 2221 uses pkill -f "oc adm drain", which can kill unrelated drain operations running in parallel and destabilize other tests. Cleanup should target only the drain process started for this node.

Suggested fix
-        LOGGER.info("Terminate drain process")
-        run_command(command=shlex.split('pkill -f "oc adm drain"'), check=False, verify_stderr=False)
+        LOGGER.info(f"Terminate drain process for node {node.name}")
+        run_command(
+            command=shlex.split(f'pkill -f "oc adm drain {node.name}"'),
+            check=False,
+            verify_stderr=False,
+        )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@utilities/virt.py` around lines 2216 - 2221, The pkill command with the
pattern "oc adm drain" is too broad and can kill unrelated drain operations from
other tests running in parallel. Instead of using the generic pattern-based
pkill in the finally block, capture the process ID (PID) when starting the nohup
drain command and store it, then use that specific PID with the kill command to
terminate only the drain process started for this particular node. This ensures
that only the drain process associated with this specific test cleanup is
terminated, preventing interference with concurrent tests.

@vsibirsk

Copy link
Copy Markdown
Collaborator Author

/verified

#4994 (comment)

@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

@coderabbitai

Test execution plan request details

CRITICAL: You MUST post an inline review comment on the first changed line of the first file.
The inline comment should contain the full Test Execution Plan (smoke decision, gating decision, and specific affected tests).
Do NOT submit a blocking review event (REQUEST_CHANGES/APPROVE).
Post a single inline PR comment on Files Changed (non-blocking COMMENT flow).

As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan.
You will post an inline review comment with the test execution plan on the first changed file.
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, fixture inheritance, fixture teardown, and yield from cleanup in conftest

  5. Detect new tests introduced in the PR

  6. Utilities and libs impact (when utilities/ or libs/ changes):
    You MUST use shell scripts (rg, git diff) to trace the full impact.
    Follow these sub-steps in order:

    6a. Identify modified symbols: For each changed file under utilities/ or libs/,
    list every modified function or method.
    Example: git diff HEAD~1 --unified=0 -- utilities/hco.py | grep '^[+-]def '

    6b. Find direct callers: Search tests and conftest for each symbol from 6a.
    Example: rg -l 'get_hco_version' tests/

    6c. Trace fixture teardown and cleanup: Find fixtures that reach
    the modified symbol through yield from or context-manager wrappers.
    Example: rg -l 'yield from.*enable_common_boot|def.*enable_common_boot' tests/

    6d. Trace same-file callers: In each changed file, find other functions
    whose body calls a modified symbol (including code after yield
    in @contextmanager helpers).
    Example: rg 'get_hco_version|enable_common_boot' utilities/hco.py

    6e. Expand transitively: If function A calls modified B, then
    tests/fixtures that call A are affected — even when the test body
    never imports B directly.

    Do NOT limit impact to tests that import the modified symbol only.

  7. Smoke test impact: Intersect the affected set from step 6 with smoke-marked tests.
    Run: rg -l '@pytest.mark.smoke' tests/
    VERIFY the above command returned actual file paths before concluding False.
    Set True if either condition is met:

    • a smoke-marked file appears in the affected set from 6b-6e, OR
    • any conftest.py in the smoke test's parent-directory hierarchy (up to repo root)
      imports or calls a modified utilities/libs symbol — including autouse fixtures
      that depend on modified functions. ALL tests in that directory and below are affected.
      Example check: for each smoke_file, scan dirname(smoke_file)/conftest.py,
      dirname(dirname(smoke_file))/conftest.py, etc. for modified symbol imports
      and autouse fixtures that depend on modified symbols.
  8. Gating test impact: Intersect the affected set from step 6 with gating-marked tests.
    Run: rg -l '@pytest.mark.gating' tests/
    Set True if a gating-marked file also appears in the affected set from 6b-6e.
    Utilities/libs changes often affect gating tests without affecting smoke tests.
    Do NOT stop analysis after concluding Run smoke tests: False.

Output rules:
Do NOT include analysis step numbers (1-8) in your visible output.

Your deliverable:
Your inline informational comment will be based on the following requirements:

Test Execution Plan

  • Run smoke tests: True / False — If True, state the dependency path (test → fixture → changed symbol). True ONLY with a verified path.
  • Run gating tests: True / False — If True, state the dependency path. True if any gating-marked test is in the affected set.
  • Affected tests to run (required when utilities/, libs/, or shared conftest changes — list concrete paths even when smoke is False)

Use these formats:

  • 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 a marker covers multiple affected tests (e.g. -m gating only if ALL gating tests in scope need run)
  • Tag each listed test or group with its marker when not obvious, e.g. (gating) or (smoke)

Real test commands (MANDATORY when changes affect session/runtime code):

When the affected code runs at session/collection time (conftest fixtures, pytest plugins,
config hooks, session-scoped setup) or modifies runtime behavior that unit tests mock away,
you MUST include concrete pytest commands the PR author must run on a real cluster
to verify the change works end-to-end. Include:

  • A command for the error/fix path (the scenario the PR fixes)
  • A command for the happy path (regression: the normal case still works)
  • Use lightweight tests (e.g., --collect-only for startup failures,
    a single small test for runtime behavior)
    If the PR only changes test logic (not utilities/libs/conftest), the affected test
    paths themselves serve as the real test commands — no separate section needed.

Example output for a session-startup fix:

**Real tests (cluster required)**
Error path (the fix):
`pytest tests/storage/.../test_foo.py --storage-class-matrix=nonexistent-sc --collect-only`
Expected: ValueError with clear message, not IndexError

Happy path (regression):
`pytest tests/storage/.../test_foo.py --storage-class-matrix=<valid-sc> -k test_bar`
Expected: session starts normally

Guidelines:

  • Include tests affected directly OR via fixture setup/teardown, yield from cleanup, or transitive utility call chains (caller calls modified helper)
  • Use a full file path only if ALL tests in that file require verification
  • Use file path + test name when only specific tests use an affected fixture or utility wrapper (preferred for partial file impact)
  • If a test marker can cover multiple files/tests, provide the marker
  • Balance coverage vs over-testing - Keep descriptions minimal
  • Example: if leaf helper foo() changes, include tests whose fixture teardown calls wrapper bar() where bar() calls foo(), even when the test body only imports an unrelated symbol from the same utilities module

Hardware-Related Checks (SR-IOV, GPU, DPDK):

When PR modifies fixtures for hardware-specific resources:

  • Collection Safety: Fixtures MUST have existence checks (return None when hardware unavailable)
  • Test Plan: MUST verify both WITH and WITHOUT hardware:
    • Run affected tests on cluster WITH hardware
    • Verify collection succeeds on cluster WITHOUT hardware

CRITICAL WORKFLOW COMPLETION RULES:

When responding to this test execution plan request, you MUST follow these rules EXACTLY:

  1. YOUR ONLY DELIVERABLE: Post one non-blocking inline comment containing the test execution plan on the first changed line
  2. THEN STOP IMMEDIATELY - Do NOT generate any additional response
  3. FALLBACK ONLY: If inline comment API calls fail after retrying, post as a regular PR comment
  4. SILENCE = SUCCESS: After successfully submitting the review, your task is complete. No confirmation needed.

ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):

  • ❌ Do NOT post acknowledgment messages like "Test execution plan posted", "Review posted successfully", "I've successfully posted"
  • ❌ Do NOT mention review IDs, URLs, or confirmation of posting in the PR thread
  • ❌ Do NOT add any follow-up comments after submitting the review
  • ❌ Do NOT reply to confirm task completion
  • ❌ Do NOT explain what you did - just do it and stop

Remember: The pull request review is visible to users. Additional comments are redundant noise.

CRITICAL — Verification rules for smoke and gating decisions:
- For each True decision, you must have traced a concrete path: test file → fixture → utility function → modified symbol.
- Do NOT assume impact based on scope, file proximity, or infrastructure-sounding names.
Only set True when you trace a concrete path through steps 6a-6e, then 7 or 8.
WRONG: "utilities/hco.py changed → run smoke" (no traced dependency path)
WRONG: "Run smoke tests: False" with no affected-test list when gating tests use the changed utility
RIGHT: "Run smoke tests: False, Run gating tests: True" plus tests/.../test_foo.py::TestBar::test_baz (gating)
RIGHT: "Smoke test X uses fixture Y → wrapper Z → changed function W in utilities/hco.py"

@@ -1,3 +1,7 @@
from __future__ import annotations

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Test Execution Plan

Run smoke tests: True
Dependency paths:

  • tests/infrastructure/instance_types/supported_os/test_rhel_os.py::TestVMMigrationAndState::test_migrate_vm (smoke+gating) → calls migrate_vm_and_verify(vm=..., client=admin_client, ...)utilities/virt.py::migrate_vm_and_verify (signature changed to mandatory client: DynamicClient)
  • tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py::TestCommonTemplatesRhel::test_migrate_vm (smoke) → same call chain

Run gating tests: True
Dependency path: 10 gating-marked files directly call migrate_vm_and_verify with the now-mandatory client argument.

Affected tests to run

(smoke)

  • tests/infrastructure/instance_types/supported_os/test_rhel_os.py::TestVMMigrationAndState::test_migrate_vm (smoke+gating)
  • tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py::TestCommonTemplatesRhel::test_migrate_vm (smoke)

(gating)

  • tests/virt/upgrade/test_upgrade_virt.py (gating)
  • tests/virt/node/general/test_machinetype.py (gating)
  • tests/storage/test_hotplug.py (gating)
  • tests/storage/online_resize/test_online_resize.py (gating)
  • tests/virt/cluster/vm_cloning/test_vm_cloning.py (gating)
  • tests/virt/cluster/vm_lifecycle/test_vm_run_strategy.py (gating)
  • tests/network/localnet/test_default_bridge.py (gating)
  • tests/virt/cluster/migration_and_maintenance/test_migration_policy.py (gating)
  • tests/network/user_defined_network/test_user_defined_network.py (gating)
  • tests/network/migration/test_masquerade_connectivity_after_migration.py (gating)

(other modified — no smoke/gating marker but directly affected)

  • tests/infrastructure/instance_types/test_cpu_memory_hotplug_instancetype.py
  • tests/infrastructure/numa/conftest.py
  • tests/network/bgp/evpn/test_evpn_connectivity.py
  • tests/network/bgp/test_bgp_connectivity.py
  • tests/network/flat_overlay/conftest.py
  • tests/network/l2_bridge/rhel9_rhel10_cluster/test_connectivity.py
  • tests/network/l2_bridge/vmi_interfaces_stability/test_interfaces_stability.py
  • tests/network/localnet/test_ovs_bridge.py
  • tests/network/migration/test_migration.py
  • tests/network/service_mesh/test_service_mesh.py
  • tests/network/sriov/test_sriov.py
  • tests/network/user_defined_network/ip_specification/test_ip_specification.py
  • tests/network/user_defined_network/test_user_defined_network_passt.py
  • tests/storage/cross_cluster_live_migration/test_cclm.py
  • tests/storage/storage_migration/test_storage_class_migration.py
  • tests/storage/upgrade/test_upgrade_storage.py
  • tests/virt/cluster/aaq/test_aaq_allocation_methods.py
  • tests/virt/cluster/aaq/test_arq.py
  • tests/virt/cluster/common_templates/centos/test_centos_os_support.py
  • tests/virt/cluster/common_templates/fedora/test_fedora_os_support.py
  • tests/virt/cluster/common_templates/rhel/test_rhel_tablet_device.py
  • tests/virt/cluster/common_templates/windows/test_windows_os_support.py
  • tests/virt/cluster/longevity_tests/test_multi_vm_multi_migration.py
  • tests/virt/cluster/sysprep/test_sysprep.py
  • tests/virt/node/general/test_windows_vtpm_bitlocker.py
  • tests/virt/node/general/test_wsl2.py
  • tests/virt/node/high_performance_vm/test_isolate_emulator_thread.py
  • tests/virt/node/hotplug/test_cpu_memory_hotplug.py
  • tests/virt/node/log_verbosity/test_log_virt_launcher.py
  • tests/virt/node/migration_and_maintenance/test_odf_vm_migration.py
  • tests/virt/node/migration_and_maintenance/test_post_copy_migration.py
  • tests/virt/node/migration_and_maintenance/test_vm_disk_load_with_migration.py
  • tests/virt/node/migration_and_maintenance/test_vm_memory_load_with_migration.py
  • tests/virt/node/readonly_disk/test_vm_with_windows_guest_tools.py
  • tests/virt/node/workload_density/test_kernel_samepage_merging.py
  • tests/virt/node/workload_density/test_swap.py

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Get current head SHA
gh api repos/RedHatQE/openshift-virtualization-tests/pulls/4994 \
  --jq '{head_sha: .head.sha, state: .state}'

echo ""
echo "=== FIRST CHANGED FILE ==="
gh api repos/RedHatQE/openshift-virtualization-tests/pulls/4994/files \
  --jq '.[0] | {filename: .filename, patch: (.patch // "no patch"), sha: .sha}' | head -40

echo ""
echo "=== VERIFY SMOKE/GATING FILES STILL CALL migrate_vm_and_verify ==="
rg -l 'migrate_vm_and_verify' tests/ --type py | while read f; do
  if rg -q '`@pytest.mark.smoke`' "$f" 2>/dev/null; then
    echo "SMOKE: $f"
  fi
  if rg -q '`@pytest.mark.gating`' "$f" 2>/dev/null; then
    echo "GATING: $f"
  fi
done

Length of output: 3195


🏁 Script executed:

#!/bin/bash
BODY='## Test Execution Plan

**Run smoke tests: True**
Dependency paths:
- `tests/infrastructure/instance_types/supported_os/test_rhel_os.py::TestVMMigrationAndState::test_migrate_vm` (smoke+gating) → calls `migrate_vm_and_verify(vm=..., client=admin_client, ...)` → `utilities/virt.py::migrate_vm_and_verify` (signature changed to mandatory `client: DynamicClient`)
- `tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py::TestCommonTemplatesRhel::test_migrate_vm` (smoke) → same call chain

**Run gating tests: True**
Dependency path: 10 gating-marked files directly call `migrate_vm_and_verify` with the now-mandatory `client` argument.

**Affected tests to run**

*(smoke)*
- `tests/infrastructure/instance_types/supported_os/test_rhel_os.py::TestVMMigrationAndState::test_migrate_vm` (smoke+gating)
- `tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py::TestCommonTemplatesRhel::test_migrate_vm` (smoke)

*(gating)*
- `tests/virt/upgrade/test_upgrade_virt.py` (gating)
- `tests/virt/node/general/test_machinetype.py` (gating)
- `tests/storage/test_hotplug.py` (gating)
- `tests/storage/online_resize/test_online_resize.py` (gating)
- `tests/virt/cluster/vm_cloning/test_vm_cloning.py` (gating)
- `tests/virt/cluster/vm_lifecycle/test_vm_run_strategy.py` (gating)
- `tests/network/localnet/test_default_bridge.py` (gating)
- `tests/virt/cluster/migration_and_maintenance/test_migration_policy.py` (gating)
- `tests/network/user_defined_network/test_user_defined_network.py` (gating)
- `tests/network/migration/test_masquerade_connectivity_after_migration.py` (gating)

*(other modified — no smoke/gating marker but directly affected)*
- `tests/infrastructure/instance_types/test_cpu_memory_hotplug_instancetype.py`
- `tests/infrastructure/numa/conftest.py`
- `tests/network/bgp/evpn/test_evpn_connectivity.py`
- `tests/network/bgp/test_bgp_connectivity.py`
- `tests/network/flat_overlay/conftest.py`
- `tests/network/l2_bridge/rhel9_rhel10_cluster/test_connectivity.py`
- `tests/network/l2_bridge/vmi_interfaces_stability/test_interfaces_stability.py`
- `tests/network/localnet/test_ovs_bridge.py`
- `tests/network/migration/test_migration.py`
- `tests/network/service_mesh/test_service_mesh.py`
- `tests/network/sriov/test_sriov.py`
- `tests/network/user_defined_network/ip_specification/test_ip_specification.py`
- `tests/network/user_defined_network/test_user_defined_network_passt.py`
- `tests/storage/cross_cluster_live_migration/test_cclm.py`
- `tests/storage/storage_migration/test_storage_class_migration.py`
- `tests/storage/upgrade/test_upgrade_storage.py`
- `tests/virt/cluster/aaq/test_aaq_allocation_methods.py`
- `tests/virt/cluster/aaq/test_arq.py`
- `tests/virt/cluster/common_templates/centos/test_centos_os_support.py`
- `tests/virt/cluster/common_templates/fedora/test_fedora_os_support.py`
- `tests/virt/cluster/common_templates/rhel/test_rhel_tablet_device.py`
- `tests/virt/cluster/common_templates/windows/test_windows_os_support.py`
- `tests/virt/cluster/longevity_tests/test_multi_vm_multi_migration.py`
- `tests/virt/cluster/sysprep/test_sysprep.py`
- `tests/virt/node/general/test_windows_vtpm_bitlocker.py`
- `tests/virt/node/general/test_wsl2.py`
- `tests/virt/node/high_performance_vm/test_isolate_emulator_thread.py`
- `tests/virt/node/hotplug/test_cpu_memory_hotplug.py`
- `tests/virt/node/log_verbosity/test_log_virt_launcher.py`
- `tests/virt/node/migration_and_maintenance/test_odf_vm_migration.py`
- `tests/virt/node/migration_and_maintenance/test_post_copy_migration.py`
- `tests/virt/node/migration_and_maintenance/test_vm_disk_load_with_migration.py`
- `tests/virt/node/migration_and_maintenance/test_vm_memory_load_with_migration.py`
- `tests/virt/node/readonly_disk/test_vm_with_windows_guest_tools.py`
- `tests/virt/node/workload_density/test_kernel_samepage_merging.py`
- `tests/virt/node/workload_density/test_swap.py`'

gh api repos/RedHatQE/openshift-virtualization-tests/pulls/4994/reviews \
  --method POST \
  --field commit_id="88bfe5bd32c5ece7702e4a5446a34ab49b6d67cd" \
  --field event="COMMENT" \
  --field body="" \
  --field "comments[][path]=tests/infrastructure/instance_types/supported_os/test_rhel_os.py" \
  --field "comments[][position]=1" \
  --field "comments[][body]=$BODY"

Length of output: 6066



@rnetser

rnetser commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

/approve
/lgtm

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.