Skip to content

refactor: extract virt fixtures from tests/conftest.py - #5682

Merged
dshchedr merged 1 commit into
RedHatQE:mainfrom
vsibirsk:vk-virt-fixtures
Oct 1, 2026
Merged

dshchedr merged 1 commit into
RedHatQE:mainfrom
vsibirsk:vk-virt-fixtures

Conversation

@vsibirsk

@vsibirsk vsibirsk commented Jul 16, 2026 •

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

Move virt-domain fixtures from the monolithic tests/conftest.py into domain-scoped modules under tests/fixtures/virt/:

  • instance_types.py — instance type and VM preference fixtures
  • migration.py — migration policy and migrated_vm_multiple_times fixtures
  • osinfo.py — libosinfo DB download fixtures
  • ssh.py — SSH key generation fixtures
  • templates.py — base_templates fixture
  • virtual_machines.py — VM creation fixtures, rhel_latest_os_params, vm_for_migration_test

Register new modules in pytest_plugins in root conftest.py.

Which issue(s) this PR fixes:
Special notes for reviewer:

Part of series of tests/conftest.py refactor.

jira-ticket:

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

Summary by CodeRabbit

  • Tests
    • Reorganized virtualization test setup into focused areas for VM lifecycle, migration, instance types, OS information, SSH access, templates, and VM actions.
    • Added reusable setup for VM creation and migration scenarios, SSH access, template retrieval, and process management.
    • Updated test fixture discovery and corrected plugin handling.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: RedHatQE/openshift-virtualization-tests/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: b6e7829e-e93d-42f7-ad6c-6e078281e04d

📥 Commits

Reviewing files that changed from the base of the PR and between 4cc7fb7 and e549143.

📒 Files selected for processing (3)
  • conftest.py
  • tests/conftest.py
  • tests/fixtures/virt/virtual_machines.py
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (2)
When an `STP:` link is present and linked-repo analysis finds missing or misaligned scenarios, you MUST post an INLINE review comment on the `STP:` line (or the module docstring when the STP line is unchanged) containing: **STP coverage: X/...

⚙️ CodeRabbit configuration file

Files:

  • tests/fixtures/virt/virtual_machines.py
  • tests/conftest.py
You may approve the PR when ALL of the following are true: All your review comments have been addressed with either: a code/doc change that fixes the issue, or a substantive author response that justifies no code change.

⚙️ CodeRabbit configuration file

Files:

  • conftest.py
  • tests/fixtures/virt/virtual_machines.py
  • tests/conftest.py
🧠 Learnings (1)
📓 Common learnings
Learnt from: vsibirsk
Repo: RedHatQE/openshift-virtualization-tests PR: 5682
File: tests/fixtures/virt/osinfo.py:21-24
Timestamp: 2026-07-19T14:53:21.907Z
Learning: For RedHatQE/openshift-virtualization-tests PRs explicitly scoped to splitting or relocating fixtures from tests/conftest.py into dedicated pytest plugin modules, do not request unrelated fixture-body changes such as adding request timeouts or changing argument style. Review fixture availability, scopes, dependencies, registration, and relocation correctness only, unless the moved code’s behavior is broken.
🔀 Multi-repo context RedHatQE/openshift-virtualization-tests-design-docs

Linked repositories findings

  • The design-doc repository contains STP requirements for VM templates, migrations, and SSH-key handling, but no direct references to the extracted fixture names or CNV-80951. [::RedHatQE/openshift-virtualization-tests-design-docs::]
  • Existing STP context remains relevant to consumers of these fixtures: template tests require instance-type/preference expansion, migration tests require supported cluster topology and direction coverage, and SSH-related tests define shared-key and missing-key scenarios. [::RedHatQE/openshift-virtualization-tests-design-docs::]
🔇 Additional comments (3)
conftest.py (1)

62-62: LGTM!

Also applies to: 109-115, 142-148, 178-178, 351-357, 545-545, 551-553, 564-564, 567-567, 630-641, 710-710

tests/conftest.py (1)

29-29: LGTM!

Also applies to: 119-119

tests/fixtures/virt/virtual_machines.py (1)

1-143: LGTM!


📝 Walkthrough

Walkthrough

Virtualization pytest fixtures move from tests/conftest.py into dedicated modules. The root conftest.py registers those modules as plugins. The shared conftest also updates its junitxml plugin check.

Changes

Virtualization fixture modularization

Layer / File(s) Summary
Plugin registration and shared conftest cleanup
conftest.py, tests/conftest.py
Registers the virtualization fixture modules, removes relocated fixture declarations and imports, and changes the junitxml check to hasplugin.
VM and instance-type fixture extraction
tests/fixtures/virt/instance_types.py, tests/fixtures/virt/virtual_machines.py, tests/conftest.py
Adds fixtures for parameterized instance types and preferences, RHEL image parameters, and Fedora, template-based, metrics, and RHEL VMs.
Migration policy and repeated migration fixtures
tests/fixtures/virt/migration.py, tests/conftest.py
Adds migration policy fixtures and a fixture that performs sequential VM migrations, waits for success, and cleans up migration resources.
OS info, SSH, templates, and VM action fixtures
tests/fixtures/virt/osinfo.py, tests/fixtures/virt/ssh.py, tests/fixtures/virt/templates.py, tests/fixtures/virt/vm_actions.py, tests/conftest.py
Adds fixtures for osinfo-db retrieval and extraction, SSH key generation, base templates, and starting a ping process on a Linux VM.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to e5491

This change moves virtualization test fixtures into dedicated modules and registers them as plugins. No concrete merge-blocking risk was identified from the supplied context. Normal CI and the reported smoke runs should cover fixture discovery.

Security Architecture Review

Security architecture risk: 🔵 Low · up to e5491

The change broadens where virtualization test fixtures can be discovered, but the examined VM, migration, and SSH-key fixtures retain their existing clients and lifecycle behavior. No introduced security issue was established; the effect on tests outside the former fixture scope remains uncertain.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — Root registration broadens potential test-suite access to VM, migration, and SSH-key fixtures, but registration alone does not create resources or demonstrate a new caller with greater authority.

Trust Boundaries and Controls

  • observed — The session SSH fixture generates a key, publishes its path in an environment variable, and removes both during teardown. Its implementation matches the former fixture, and the tests-scoped autouse fixture still requests it.
🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title is 54 characters, stays under the 120-character limit, and clearly describes extracting virtualization fixtures from tests/conftest.py.
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.
Pr Template Sections ✅ Passed The PR description contains all four required sections with the exact template headings. The “What this PR does / why we need it” section has meaningful content describing the fixture extraction and m…
Stp Link Required ✅ Passed PASS — The authoritative PR diff adds only fixture modules under tests/fixtures/virt/ and modifies tests/conftest.py. No newly added test_*.py file and no newly added def test_* function appea…
Stp Scenario Coverage ✅ Passed PASS — the PR does not add, modify, or delete any test_*.py file under tests/. The authoritative diff contains only conftest.py and fixture modules, so the STP/Jira/RFE scenario coverage check i…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

@vsibirsk vsibirsk changed the title refactor(tests): extract virt fixtures from tests/conftest.py refactor: extract virt fixtures from tests/conftest.py Jul 16, 2026
@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

Report bugs in Issues

Welcome! 🎉

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

🔄 Automatic Actions

  • Reviewer Assignment: Reviewers are automatically assigned based on the OWNERS file in the repository root
  • Size Labeling: PR size labels (XS, S, M, L, XL, XXL) are automatically applied based on changes
  • Issue Creation: A tracking issue is created for this PR and will be closed when the PR is merged or closed
  • 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
  • /security-override - Set security check runs to pass (maintainers only)
  • /security-override cancel - Re-run security checks

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
  • /cherry-pick-retry <branch> - Retry a failed cherry-pick (merged PRs only)

Branch Management

  • /rebase - Rebase this PR branch onto its base branch

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:

  • dshchedr
  • myakove
  • rnetser
  • vsibirsk

Reviewers:

  • RoniKishner
  • dshchedr
  • rnetser
  • vsibirsk
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
AI Features
  • Cherry-Pick Conflict Resolution: Enabled (claude/claude-opus-4-6-1m)
Security Checks
  • Suspicious Path Detection: Monitors paths: .claude/, .vscode/, .cursor/, .devcontainer/, .pi/, .github/workflows/, .github/actions/
  • Committer Identity Check: Verifies last committer matches PR author
  • Mandatory: Security checks block merge (use /security-override to bypass — maintainers only)

💡 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

📌 Additional Information

Custom Commands:

  • /test-plan — Triggers CodeRabbit to analyze the PR's changed files and post a test execution plan
  • /rerun-smoke — Adds retest-smoke label on the PR to trigger smoke tests execution

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

Comment thread tests/fixtures/virt/instance_types.py Resolved
Comment thread tests/fixtures/virt/virtual_machines.py Resolved
Comment thread tests/fixtures/virt/virtual_machines.py Resolved
Comment thread tests/fixtures/virt/virtual_machines.py Resolved
@vsibirsk

Copy link
Copy Markdown
Collaborator Author

/verified

smoke

$ uv run pytest -rA -s -o log_cli=true --tc-file=tests/global_config.py --tc-format=python --cluster-sanity-skip-check --storage-class-matrix=ocs-storagecluster-ceph-rbd-virtualization --skip-deprecated-api-test tests -m smoke --latest-rhe
...
============================================================================================= short test summary info ==============================================================================================
PASSED tests/infrastructure/instance_types/supported_os/test_rhel_os.py::TestVMCreationAndValidation::test_create_vm[#rhel.10#-#ocs-storagecluster-ceph-rbd-virtualization#]
PASSED tests/infrastructure/instance_types/supported_os/test_rhel_os.py::TestVMCreationAndValidation::test_start_vm[#rhel.10#-#ocs-storagecluster-ceph-rbd-virtualization#]
PASSED tests/infrastructure/instance_types/supported_os/test_rhel_os.py::TestVMCreationAndValidation::test_vm_console[#rhel.10#-#ocs-storagecluster-ceph-rbd-virtualization#]
PASSED tests/infrastructure/instance_types/supported_os/test_rhel_os.py::TestVMCreationAndValidation::test_expose_ssh[#rhel.10#-#ocs-storagecluster-ceph-rbd-virtualization#]
PASSED tests/infrastructure/instance_types/supported_os/test_rhel_os.py::TestVMCreationAndValidation::test_vmi_guest_agent_exists[#rhel.10#-#ocs-storagecluster-ceph-rbd-virtualization#]
PASSED tests/infrastructure/instance_types/supported_os/test_rhel_os.py::TestVMDeletion::test_vm_deletion[#rhel.10#-#ocs-storagecluster-ceph-rbd-virtualization#]
PASSED tests/install_upgrade_operators/csv/test_csv.py::test_csv_keywords
PASSED tests/install_upgrade_operators/csv/test_csv.py::test_csv_links
PASSED tests/install_upgrade_operators/csv/test_csv.py::test_csv_icon
PASSED tests/install_upgrade_operators/csv/test_csv.py::test_csv_properties
PASSED tests/storage/cdi_clone/test_clone.py::test_clone_from_block_to_fs_using_dv_template
PASSED tests/storage/cdi_import/test_import_http.py::test_successful_import_basic_auth[#ocs-storagecluster-ceph-rbd-virtualization#-kubevirt-alpine-3.20.1-x86_64-disk.raw.xz]
PASSED tests/storage/cdi_import/test_import_registry.py::test_public_registry_data_volume[#ocs-storagecluster-ceph-rbd-virtualization#-import-public-registry-no-content-type-dv]
PASSED tests/storage/cdi_upload/test_upload_virtctl.py::test_virtctl_image_upload_dv[#ocs-storagecluster-ceph-rbd-virtualization#]
PASSED tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py::TestCommonTemplatesRhel::test_create_vm[#rhel.9.6#]
PASSED tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py::TestCommonTemplatesRhel::test_start_vm[#rhel.9.6#]
PASSED tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py::TestCommonTemplatesRhel::test_vm_console[#rhel.9.6#]
PASSED tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py::TestCommonTemplatesRhel::test_expose_ssh[#rhel.9.6#]
PASSED tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py::TestCommonTemplatesRhel::test_vmi_guest_agent_exists[#rhel.9.6#]
PASSED tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py::TestCommonTemplatesRhel::test_migrate_vm[#rhel.9.6#]
PASSED tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py::TestCommonTemplatesRhel::test_vm_deletion[#rhel.9.6#]
PASSED tests/virt/node/general/test_container_disk_vm.py::test_container_disk_vm
=========================================================================== 22 passed, 2165 deselected, 19 warnings in 881.47s (0:14:41) ===========================================================================

@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 conftest.py Resolved
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '=== PR metadata and changed files ==='
gh pr view 5682 --json baseRefName,headRefName,files --jq '{baseRefName,headRefName,files:[.files[].path]}'

echo '=== Diff name/status and first changed hunk ==='
git diff --name-status "origin/$(gh pr view 5682 --json baseRefName --jq .baseRefName)...HEAD"
first_file="$(git diff --name-only "origin/$(gh pr view 5682 --json baseRefName --jq .baseRefName)...HEAD" | head -n1)"
printf 'FIRST_FILE=%s\n' "$first_file"
git diff --unified=0 "origin/$(gh pr view 5682 --json baseRefName --jq .baseRefName)...HEAD" -- "$first_file" | sed -n '1,100p'

echo '=== Changed-file outlines ==='
git diff --name-only "origin/$(gh pr view 5682 --json baseRefName --jq .baseRefName)...HEAD" \
  | while IFS= read -r file; do
      echo "--- $file"
      ast-grep outline "$file" --items all 2>/dev/null || true
    done

Length of output: 1753


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '=== PR files and patches from GitHub ==='
gh api --paginate "repos/RedHatQE/openshift-virtualization-tests/pulls/5682/files?per_page=100" \
  --jq '.[] | "FILE: \(.filename)\nSTATUS: \(.status)\nPATCH:\n\(.patch // "(no textual patch)")\n---"' \
  > /tmp/pr5682-files.txt
sed -n '1,2400p' /tmp/pr5682-files.txt

echo '=== First changed file and first added/changed line from patch ==='
python3 - <<'PY'
import json, subprocess
files = json.loads(subprocess.check_output([
    "gh", "api", "--paginate",
    "repos/RedHatQE/openshift-virtualization-tests/pulls/5682/files?per_page=100"
]))
first = files[0]
line = None
new_line = 0
for row in (first.get("patch") or "").splitlines():
    if row.startswith("@@"):
        rhs = row.split("+", 1)[1].split(" ", 1)[0]
        new_line = int(rhs.split(",", 1)[0])
    elif row.startswith("+") and not row.startswith("+++"):
        line = new_line
        break
    elif not row.startswith("-"):
        new_line += 1
print(f'{first["filename"]}:{line}')
PY

echo '=== Current changed-module fixture definitions ==='
for f in conftest.py tests/conftest.py tests/fixtures/virt/*.py; do
  if [ -f "$f" ]; then
    echo "--- $f"
    rg -n -C2 '^`@pytest`\.fixture|^def |^pytest_plugins' "$f" || true
  fi
done

echo '=== Fixture reference candidates across tests (excluding changed modules) ==='
rg -n --glob '*.py' \
  '\b(instance_type|vm_preference|migration_policy|migrated_vm_multiple_times|osinfo|ssh_key|base_templates|rhel_latest_os_params|vm_for_migration_test|vm_actions)\b' \
  tests -g '!tests/conftest.py' -g '!tests/fixtures/virt/**' || true

echo '=== Smoke and gating marked files ==='
printf '%s\n' '[smoke]'
rg -l '`@pytest`\.mark\.smoke' tests/ || true
printf '%s\n' '[gating]'
rg -l '`@pytest`\.mark\.gating' tests/ || true

Length of output: 100837


🏁 Script executed:

#!/bin/bash
set -euo pipefail

fixtures=(
  common_instance_type_param_dict instance_type_for_test_scope_class
  common_vm_preference_param_dict vm_preference_for_test
  migration_policy_with_bandwidth migration_policy_with_bandwidth_scope_class migrated_vm_multiple_times
  osinfo_repo latest_osinfo_db_file_name downloaded_latest_libosinfo_db
  ssh_key_tmpdir_scope_session generated_ssh_key_for_vm_access
  base_templates rhel_latest_os_params vm_for_migration_test vm_for_test running_metric_vm
  vm_from_template_with_existing_dv started_windows_vm rhel_vm_with_instance_type_and_preference
  rhel_vm_with_cluster_instance_type_and_preference ping_process_in_rhel_os
)
echo '=== Exact moved-fixture consumers (tests only, changed fixture modules excluded) ==='
for fixture in "${fixtures[@]}"; do
  echo "--- FIXTURE: $fixture"
  rg -n -P "(?<![A-Za-z0-9_])${fixture}(?![A-Za-z0-9_])" tests \
    -g '*.py' -g '!tests/conftest.py' -g '!tests/fixtures/virt/**' || true
done

echo '=== Signatures, fixture parametrization, and markers in direct consumer files ==='
consumer_files=(
 tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py
 tests/infrastructure/golden_images/update_boot_source/test_ssp_common_templates_boot_sources.py
 tests/infrastructure/golden_images/update_boot_source/test_ssp_data_sources.py
 tests/virt/cluster/common_templates/custom_namespace/conftest.py
 tests/virt/cluster/common_templates/custom_namespace/test_custom_namespace.py
 tests/virt/cluster/common_templates/general/test_base_template.py
 tests/virt/cluster/migration_and_maintenance/test_evictionstrategy.py
 tests/observability/metrics/test_ssp_metrics.py
 tests/virt/upgrade/conftest.py
 tests/virt/upgrade/test_upgrade_virt.py
 tests/storage/storage_migration/conftest.py
 tests/install_upgrade_operators/must_gather/conftest.py
 tests/install_upgrade_operators/must_gather/test_must_gather_vms.py
)
for file in "${consumer_files[@]}"; do
  if [ -f "$file" ]; then
    echo "--- $file"
    rg -n -C2 '`@pytest`\.mark|`@pytest`\.fixture|def (test_|[A-Za-z_]+)\(' "$file" || true
  fi
done

echo '=== Smoke/gating files: direct fixture uses and local conftest chains ==='
for file in $(rg -l '`@pytest`\.mark\.(smoke|gating)' tests/); do
  hits=$(rg -n -P '(?<![A-Za-z0-9_])(common_instance_type_param_dict|instance_type_for_test_scope_class|common_vm_preference_param_dict|vm_preference_for_test|migration_policy_with_bandwidth|migration_policy_with_bandwidth_scope_class|migrated_vm_multiple_times|osinfo_repo|latest_osinfo_db_file_name|downloaded_latest_libosinfo_db|ssh_key_tmpdir_scope_session|generated_ssh_key_for_vm_access|base_templates|rhel_latest_os_params|vm_for_migration_test|vm_for_test|running_metric_vm|vm_from_template_with_existing_dv|started_windows_vm|rhel_vm_with_instance_type_and_preference|rhel_vm_with_cluster_instance_type_and_preference|ping_process_in_rhel_os)(?![A-Za-z0-9_])' "$file" || true)
  if [ -n "$hits" ]; then echo "--- $file"; echo "$hits"; fi
done

Length of output: 98234


🏁 Script executed:

#!/bin/bash
set -euo pipefail

head_sha="$(gh pr view 5682 --json headRefOid --jq .headRefOid)"
body="$(cat <<'EOF'
## Test Execution Plan

**Run smoke tests: True** — verified paths:
- `tests/infrastructure/instance_types/supported_os/test_rhel_os.py::TestVM...::test_pause_unpause_after_migrate` *(smoke, gating)* → `ping_process_in_rhel_os` → relocated `tests/fixtures/virt/vm_actions.py`.
- `tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py::TestVM...::test_pause_unpause_after_migrate` *(smoke)* → `ping_process_in_rhel_os` → relocated `tests/fixtures/virt/vm_actions.py`.

**Run gating tests: True** — verified paths:
- `tests/virt/cluster/common_templates/general/test_base_template.py::test_base_templates_annotations` *(gating)* → `base_templates` → relocated `tests/fixtures/virt/templates.py`.
- `tests/virt/cluster/common_templates/general/test_base_template.py::test_validate_rhel_min_max_memory` *(gating file)* → `downloaded_latest_libosinfo_db` → `latest_osinfo_db_file_name` / `osinfo_repo` → relocated `tests/fixtures/virt/osinfo.py`.
- `tests/infrastructure/instance_types/supported_os/test_rhel_os.py::TestVM...::test_pause_unpause_after_migrate` *(gating)* → `ping_process_in_rhel_os` → relocated `tests/fixtures/virt/vm_actions.py`.

**Affected tests to run**
- `tests/infrastructure/instance_types/supported_os/test_rhel_os.py` *(smoke, gating)*
- `tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py` *(smoke)*
- `tests/virt/cluster/common_templates/general/test_base_template.py` *(gating; templates, libosinfo download, existing-DV VM fixture)*
- `tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py` *(instance-type/preference fixtures)*
- `tests/install_upgrade_operators/must_gather/test_must_gather_vms.py::TestNoMultipleFilesCollected::test_no_multiple_empty_files_collected_from_must_gather_migrated_vm` *(migration VM setup and cleanup)*
- `tests/storage/cdi_import/test_import_http.py::Test...` Windows-import case using `started_windows_vm` *(Windows VM fixture)*
- `tests/virt/upgrade/test_upgrade_virt.py::Test...::test_golden_image_pvc_names_after_upgrade` *(gating file; `base_templates` and `rhel_latest_os_params` chain)*

**Real tests (cluster required)**

Error/fix path — validate plugin registration and fixture discovery after removing the fixtures from `tests/conftest.py`:
```bash
uv run pytest --tc-file=tests/global_config.py --tc-format=python --collect-only \
  tests/infrastructure/instance_types/supported_os/test_rhel_os.py \
  tests/virt/cluster/common_templates/general/test_base_template.py

Expected: collection succeeds with no fixture ... not found or plugin-import errors.

Happy path — run direct smoke consumers:

uv run pytest --tc-file=tests/global_config.py --tc-format=python \
  --cluster-sanity-skip-check --storage-class-matrix=<valid-storage-class> \
  tests/infrastructure/instance_types/supported_os/test_rhel_os.py \
  tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py -m smoke

Expected: VM lifecycle/migration tests complete and ping_process_in_rhel_os setup/teardown works.

Also run the gating fixture paths:

uv run pytest --tc-file=tests/global_config.py --tc-format=python \
  --cluster-sanity-skip-check \
  tests/virt/cluster/common_templates/general/test_base_template.py -m gating

Expected: base-template enumeration and libosinfo download fixtures resolve from their relocated plugins.
EOF
)"

gh api --method POST "repos/RedHatQE/openshift-virtualization-tests/pulls/5682/comments"
-f body="$body"
-f commit_id="$head_sha"
-f path="conftest.py"
-F line=82
-f side="RIGHT"
--jq '{id, path, line, side}'


Length of output: 3960

---

</details>

@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: 4

🤖 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/conftest.py`:
- Around line 2388-2391: Update skip_if_no_cpumanager_workers to pass the
label-checking generator directly to any instead of materializing it with a list
comprehension, preserving the existing skip behavior and short-circuit
evaluation.

In `@tests/fixtures/virt/migration.py`:
- Around line 34-49: Wrap the setup loop and yield in migrated_vm_multiple_times
with a try/finally so cleanup always executes when deploy or wait_for_status
fails. Keep tracking each successfully created migration in vmim, and run
mig_obj.clean_up() for all tracked migrations from the finally block.

In `@tests/fixtures/virt/osinfo.py`:
- Around line 21-24: The requests.get call in the BeautifulSoup setup must use
an explicit timeout and pass the repository URL via the named url= argument.
Update the call while preserving its existing headers, certificate verification,
and response text handling.

In `@tests/fixtures/virt/virtual_machines.py`:
- Around line 109-129: Update the rhel_vm_with_instance_type_and_preference
fixture to combine the instance type, VM preference, and VirtualMachineForTests
context managers into a single parenthesized with statement, preserving their
existing aliases, arguments, and yield behavior.
🪄 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: 643c8d7a-2f37-4909-abaf-a2b660c9a177

📥 Commits

Reviewing files that changed from the base of the PR and between 934e04e and 760eb3b.

📒 Files selected for processing (10)
  • conftest.py
  • tests/conftest.py
  • tests/fixtures/virt/__init__.py
  • tests/fixtures/virt/instance_types.py
  • tests/fixtures/virt/migration.py
  • tests/fixtures/virt/osinfo.py
  • tests/fixtures/virt/ssh.py
  • tests/fixtures/virt/templates.py
  • tests/fixtures/virt/virtual_machines.py
  • tests/fixtures/virt/vm_actions.py
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • RedHatQE/openshift-virtualization-tests-design-docs (manual)

Comment thread tests/conftest.py Resolved
Comment thread tests/fixtures/virt/migration.py Resolved
Comment thread tests/fixtures/virt/osinfo.py Resolved
Comment thread tests/fixtures/virt/virtual_machines.py Resolved
@vsibirsk

Copy link
Copy Markdown
Collaborator Author

/verified

#5682 (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 conftest.py Resolved
@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="RedHatQE/openshift-virtualization-tests"
pr="5682"
base="$(gh pr view "$pr" --json baseRefName --jq '.baseRefName')"
range="origin/${base}...HEAD"

echo "HEAD=$(gh pr view "$pr" --json headRefOid --jq '.headRefOid')"
echo '=== changed files ==='
git diff --name-status "$range"

echo '=== first changed location ==='
first_file="$(git diff --name-only "$range" | head -n 1)"
echo "FILE=$first_file"
git diff --unified=0 "$range" -- "$first_file" | sed -n '1,100p'

echo '=== plugin registrations ==='
rg -n 'tests\.fixtures\.virt\.(instance_types|migration|osinfo|ssh|templates|virtual_machines|vm_actions)' conftest.py || true

echo '=== relocated fixture consumers ==='
fixtures='common_instance_type_param_dict|instance_type_for_test_scope_class|common_vm_preference_param_dict|vm_preference_for_test|migration_policy_with_bandwidth|migration_policy_with_bandwidth_scope_class|migrated_vm_multiple_times|osinfo_repo|latest_osinfo_db_file_name|downloaded_latest_libosinfo_db|ssh_key_tmpdir_scope_session|generated_ssh_key_for_vm_access|base_templates|rhel_latest_os_params|vm_for_migration_test|vm_for_test|running_metric_vm|vm_from_template_with_existing_dv|started_windows_vm|rhel_vm_with_instance_type_and_preference|rhel_vm_with_cluster_instance_type_and_preference|ping_process_in_rhel_os'
rg -n -P "(?<![A-Za-z0-9_])(${fixtures})(?![A-Za-z0-9_])" tests \
  -g '*.py' -g '!tests/conftest.py' -g '!tests/fixtures/virt/**' || true

echo '=== smoke marker files ==='
rg -l '`@pytest`\.mark\.smoke' tests || true
echo '=== gating marker files ==='
rg -l '`@pytest`\.mark\.gating' tests || true

echo '=== marker and test context in known direct consumers ==='
rg -n -C3 '`@pytest`\.mark\.(smoke|gating)|^class Test|^\s*def test_' \
  tests/infrastructure/instance_types/supported_os/test_rhel_os.py \
  tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py \
  tests/virt/cluster/common_templates/general/test_base_template.py \
  tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py \
  tests/install_upgrade_operators/must_gather/test_must_gather_vms.py \
  tests/storage/cdi_import/test_import_http.py \
  tests/virt/upgrade/test_upgrade_virt.py 2>/dev/null || true

Length of output: 2701


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="RedHatQE/openshift-virtualization-tests"
pr="5682"

gh api "repos/${repo}/pulls/${pr}" --jq '{head: .head.sha, base: .base.ref}'
gh api --paginate "repos/${repo}/pulls/${pr}/files?per_page=100" > /tmp/pr5682-files.json

echo '=== changed files and first inline location ==='
python3 - <<'PY'
import json
files = json.load(open("/tmp/pr5682-files.json"))
for item in files:
    print(f'{item["status"]}\t{item["filename"]}')
first = files[0]
line = None
new_line = 0
for row in (first.get("patch") or "").splitlines():
    if row.startswith("@@"):
        new_line = int(row.split("+", 1)[1].split(" ", 1)[0].split(",", 1)[0])
    elif row.startswith("+") and not row.startswith("+++"):
        line = new_line
        break
    elif not row.startswith("-"):
        new_line += 1
print(f'INLINE={first["filename"]}:{line}')
PY

echo '=== plugin registrations ==='
rg -n 'tests\.fixtures\.virt\.(instance_types|migration|osinfo|ssh|templates|virtual_machines|vm_actions)' conftest.py || true

echo '=== direct relocated-fixture consumers ==='
fixtures='common_instance_type_param_dict|instance_type_for_test_scope_class|common_vm_preference_param_dict|vm_preference_for_test|migration_policy_with_bandwidth|migration_policy_with_bandwidth_scope_class|migrated_vm_multiple_times|osinfo_repo|latest_osinfo_db_file_name|downloaded_latest_libosinfo_db|ssh_key_tmpdir_scope_session|generated_ssh_key_for_vm_access|base_templates|rhel_latest_os_params|vm_for_migration_test|vm_for_test|running_metric_vm|vm_from_template_with_existing_dv|started_windows_vm|rhel_vm_with_instance_type_and_preference|rhel_vm_with_cluster_instance_type_and_preference|ping_process_in_rhel_os'
rg -n -P "(?<![A-Za-z0-9_])(${fixtures})(?![A-Za-z0-9_])" tests \
  -g '*.py' -g '!tests/conftest.py' -g '!tests/fixtures/virt/**' || true

echo '=== marker evidence ==='
rg -n '`@pytest`\.mark\.(smoke|gating)' \
  tests/infrastructure/instance_types/supported_os/test_rhel_os.py \
  tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py \
  tests/virt/cluster/common_templates/general/test_base_template.py \
  tests/virt/upgrade/test_upgrade_virt.py 2>/dev/null || true

Length of output: 28238


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="RedHatQE/openshift-virtualization-tests"
pr="5682"
head_sha="$(gh api "repos/${repo}/pulls/${pr}" --jq '.head.sha')"

body="$(cat <<'EOF'
## Test Execution Plan

**Run smoke tests: True.**
- `tests/infrastructure/instance_types/supported_os/test_rhel_os.py::TestVMMigrationAndState::test_pause_unpause_after_migrate` *(smoke, gating)* → `ping_process_in_rhel_os` → `tests.fixtures.virt.vm_actions`.
- `tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py::TestCommonTemplatesRhel::test_pause_unpause_after_migrate` *(smoke)* → `ping_process_in_rhel_os` → `tests.fixtures.virt.vm_actions`.

**Run gating tests: True.**
- `tests/virt/cluster/common_templates/general/test_base_template.py::test_base_templates_annotations` *(gating)* → `base_templates` → `tests.fixtures.virt.templates`.
- `tests/virt/cluster/common_templates/general/test_base_template.py::test_validate_rhel_min_max_memory` and `::test_validate_windows_min_max_memory` *(gating)* → `downloaded_latest_libosinfo_db` → `tests.fixtures.virt.osinfo`.
- `tests/virt/upgrade/test_upgrade_virt.py::TestUpgradeVirt::test_golden_image_pvc_names_after_upgrade` *(gating)* → `base_templates` → `tests.fixtures.virt.templates`.

**Affected tests to run**
- `tests/infrastructure/instance_types/supported_os/test_rhel_os.py` *(smoke, gating)*
- `tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py` *(smoke)*
- `tests/virt/cluster/common_templates/general/test_base_template.py` *(gating; template, osinfo, and existing-DV VM fixtures)*
- `tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py` *(instance type and preference fixtures)*
- `tests/install_upgrade_operators/must_gather/test_must_gather_vms.py::TestNoMultipleFilesCollected::test_no_multiple_empty_files_collected_from_must_gather_migrated_vm` *(migration fixture setup and cleanup)*
- `tests/storage/cdi_import/test_import_http.py` *(Windows VM fixture)*
- `tests/observability/metrics/test_vms_metrics.py` *(VM and metric VM fixtures)*
- `tests/virt/upgrade/test_upgrade_virt.py::TestUpgradeVirt::test_golden_image_pvc_names_after_upgrade` *(gating)*

**Real tests (cluster required)**

Error path — verify fixture plugin registration and discovery:
```bash
uv run pytest --tc-file=tests/global_config.py --tc-format=python --collect-only \
  tests/infrastructure/instance_types/supported_os/test_rhel_os.py \
  tests/virt/cluster/common_templates/general/test_base_template.py
```
Expected: collection completes with no plugin import error and no `fixture ... not found` error.

Happy path — verify relocated smoke fixtures:
```bash
uv run pytest --tc-file=tests/global_config.py --tc-format=python \
  --cluster-sanity-skip-check --storage-class-matrix=<valid-storage-class> \
  tests/infrastructure/instance_types/supported_os/test_rhel_os.py \
  tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py -m smoke
```
Expected: VM lifecycle and migration tests pass. `ping_process_in_rhel_os` resolves from `tests.fixtures.virt.vm_actions`.

Gating regression:
```bash
uv run pytest --tc-file=tests/global_config.py --tc-format=python \
  --cluster-sanity-skip-check \
  tests/virt/cluster/common_templates/general/test_base_template.py -m gating
```
Expected: `base_templates` and `downloaded_latest_libosinfo_db` resolve from their relocated fixture modules.
EOF
)"

for attempt in 1 2; do
  if gh api --method POST "repos/${repo}/pulls/${pr}/comments" \
    -f body="$body" \
    -f commit_id="$head_sha" \
    -f path="conftest.py" \
    -F line=108 \
    -f side="RIGHT" >/dev/null; then
    exit 0
  fi
  [ "$attempt" -eq 1 ] || exit 1
  sleep 2
done

Length of output: 3805


@openshift-virtualization-qe-bot-3

You are interacting with an AI system.

@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

/retest all

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

Overlapping files

conftest.py

coderabbitai[bot]
coderabbitai Bot previously approved these changes Sep 16, 2026
@dshchedr

Copy link
Copy Markdown
Collaborator

/lgtm
/approve

@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

/retest all

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

Overlapping files

tests/conftest.py

CNV-80951 — move virt fixtures into domain modules under
tests/fixtures/virt/, rebased onto main (prior conftest extractions already merged).

Modules:
- instance_types.py — instance type and VM preference param fixtures
- migration.py — migration policy, migrated_vm_multiple_times,
  is_postcopy_migration_bug_open
- osinfo.py — libosinfo DB download fixtures
- ssh.py — SSH key generation fixtures
- templates.py — base_templates
- virtual_machines.py — all VM creation fixtures and rhel_latest_os_params
- vm_actions.py — ping_process_in_rhel_os (per review feedback)

Register all seven modules in pytest_plugins in root conftest.py.

Assisted-by: Cursor Agent (Composer 2.5)
Signed-off-by: vsibirsk <[email protected]>
@vsibirsk

Copy link
Copy Markdown
Collaborator Author

/verified

#5682 (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 conftest.py Resolved
@coderabbitai

coderabbitai Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
gh api repos/RedHatQE/openshift-virtualization-tests/pulls/5682 --jq '{head:.head.sha,base:.base.sha}'
gh api --paginate 'repos/RedHatQE/openshift-virtualization-tests/pulls/5682/files?per_page=100' > /tmp/pr5682-files.json
python - <<'PY'
import json
for f in json.load(open('/tmp/pr5682-files.json')):
 print('\nFILE:',f['filename'],'\n',f.get('patch','NO PATCH'))
PY
git rev-parse HEAD
for f in conftest.py tests/conftest.py tests/fixtures/virt/*.py; do
 [ ! -f "$f" ] || ast-grep outline "$f" --items all
done
echo SMOKE
rg -l '@pytest.mark.smoke' tests/ || true
echo GATING
rg -l '@pytest.mark.gating' tests/ || true

Length of output: 43651


🏁 Script executed:

#!/bin/bash
set -euo pipefail
sed -n '55,105p' tests/conftest.py
sed -n '350,378p' tests/conftest.py
python - <<'PY'
import ast,json,pathlib
changed=json.load(open('/tmp/pr5682-files.json'))
roots=set()
for f in changed:
 p=pathlib.Path(f['filename'])
 if '/virt/' in str(p) and p.suffix=='.py':
  t=ast.parse(p.read_text())
  roots.update(n.name for n in t.body if isinstance(n,ast.FunctionDef))
roots.add('junitxml_plugin')
records=[]
for p in pathlib.Path('tests').rglob('*.py'):
 try: t=ast.parse(p.read_text())
 except SyntaxError: continue
 def walk(nodes,cls='',marks=()):
  for n in nodes:
   if isinstance(n,ast.ClassDef):
    walk(n.body,n.name,marks+tuple(ast.unparse(d) for d in n.decorator_list))
   elif isinstance(n,(ast.FunctionDef,ast.AsyncFunctionDef)):
    dec=marks+tuple(ast.unparse(d) for d in n.decorator_list)
    refs={a.arg for a in n.args.args}
    refs.update(x.id for x in ast.walk(n) if isinstance(x,ast.Name))
    refs.update(x.value for x in ast.walk(n) if isinstance(x,ast.Constant) and isinstance(x.value,str))
    records.append((str(p),cls,n.name,n.lineno,refs,dec))
 walk(t.body,marks=tuple(ast.unparse(n.value) for n in t.body if isinstance(n,ast.Assign) and any(isinstance(x,ast.Name) and x.id=='pytestmark' for x in n.targets)))
affected=set(roots)
for _ in range(20):
 new=affected|{r[2] for r in records if r[4]&affected and not r[2].startswith('test_')}
 if new==affected:break
 affected=new
print('ROOTS:',sorted(roots))
print('AFFECTED FIXTURES / WRAPPERS:')
for p,c,n,l,refs,d in records:
 if not n.startswith('test_') and refs&affected and '/fixtures/virt/' not in p:
  print(f'{p}:{l} {n} <- {sorted(refs&affected)} '+ ('AUTOUSE' if any('autouse=True' in s for s in d) else ''))
print('AFFECTED TESTS:')
for p,c,n,l,refs,d in records:
 if n.startswith('test_') and refs&affected:
  markers=[x for x in ('smoke','gating') if any('mark.'+x in s for s in d)]
  print(p+'::'+(c+'::' if c else '')+n, 'markers='+','.join(markers),'via='+','.join(sorted(refs&affected)))
print('HARDWARE PARAM CONSUMERS:')
for p,c,n,l,refs,d in records:
 if refs&{'common_instance_type_param_dict','instance_type_for_test_scope_class','rhel_vm_with_instance_type_and_preference'} and any('gpus_list' in x or 'host_devices_list' in x for x in d):
  print(p,c,n)
PY
for f in tests/infrastructure/instance_types/supported_os/test_rhel_os.py tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py tests/virt/cluster/common_templates/general/test_base_template.py tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py; do
 ast-grep outline "$f" --items all
done
rg -n -C3 '\b(ping_process_in_rhel_os|generated_ssh_key_for_vm_access|junitxml_plugin|migration_policy_with_bandwidth_scope_class|migration_policy_with_bandwidth|migrated_vm_multiple_times|gpus_list|host_devices_list)\b' tests -g '*.py' -g '!tests/fixtures/virt/**'
fd -i '^global_config.*\.py$' tests

Length of output: 44134


🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n -C2 '^def (vm_for_test|running_metric_vm|instance_type_for_test_scope_class|base_templates|junitxml_plugin|generated_ssh_key_for_vm_access)\(' tests -g '*.py'
sed -n '40,90p' tests/infrastructure/instance_types/supported_os/test_rhel_os.py
sed -n '135,185p' tests/infrastructure/instance_types/supported_os/test_rhel_os.py
sed -n '185,212p' tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py
sed -n '190,205p' tests/virt/cluster/common_templates/general/test_base_template.py
sed -n '235,270p' tests/virt/cluster/common_templates/general/test_base_template.py
sed -n '320,350p' tests/virt/cluster/common_templates/general/test_base_template.py
sed -n '1,145p' tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py
for f in tests/fixtures/cluster/sanity.py tests/observability/metrics/conftest.py tests/storage/storage_migration/conftest.py tests/virt/node/general/test_vmi_reset.py tests/virt/cluster/vm_lifecycle/test_vm_run_strategy.py tests/virt/upgrade/test_upgrade_virt.py tests/virt/cluster/sysprep/test_sysprep.py; do
 ast-grep outline "$f" --items all
done
sed -n '1,65p' tests/fixtures/cluster/sanity.py
sed -n '135,195p' tests/storage/storage_migration/conftest.py
rg -n -C2 '\b(vm_for_storage_class_migration_from_template_with_dv|created_multiple_failed_vms)\b' tests -g '*.py'
sed -n '1,70p' tests/virt/node/general/test_container_disk_vm.py
sed -n '440,465p' conftest.py
sed -n '620,650p' conftest.py
git diff --stat 7d850a8ca3ca377c840b8209fde03c8e525521a5...HEAD

Length of output: 43623


🏁 Script executed:

#!/bin/bash
set -euo pipefail
for f in tests/storage/storage_migration/test_storage_class_migration.py tests/observability/metrics/test_ssp_metrics.py tests/observability/metrics/test_migration_metrics.py tests/observability/metrics/test_vms_metrics.py tests/install_upgrade_operators/must_gather/test_must_gather_vm_preferences.py tests/install_upgrade_operators/must_gather/test_must_gather_vms.py; do
 ast-grep outline "$f" --items all
done
sed -n '1,115p' tests/storage/storage_migration/test_storage_class_migration.py
sed -n '210,236p' tests/storage/storage_migration/conftest.py
sed -n '110,155p' tests/observability/metrics/test_ssp_metrics.py
sed -n '60,83p' tests/virt/upgrade/test_upgrade_virt.py
sed -n '135,162p' tests/virt/cluster/sysprep/test_sysprep.py
rg -n -C2 'gpus_list|host_devices_list|def .*gpu|def .*sriov' tests/infrastructure/instance_types tests/virt/cluster/sysprep
gh api repos/RedHatQE/openshift-virtualization-tests/pulls/5682 --jq .head.sha

Length of output: 17968


🏁 Script executed:

#!/bin/bash
set -euo pipefail
python - <<'PY'
import json,re,subprocess,time
repo='RedHatQE/openshift-virtualization-tests'
pr=5682
def api(endpoint):
 return json.loads(subprocess.check_output(['gh','api',endpoint],text=True))
meta=api(f'repos/{repo}/pulls/{pr}')
if meta['head']['sha']!='e5491433a452beb97ded367fd02cadddf11aeaa7':
 raise SystemExit('PR head changed. Reinspect before posting.')
files=api(f'repos/{repo}/pulls/{pr}/files?per_page=100')
first=files[0]
old=new=0
location=None
for row in first.get('patch','').splitlines():
 if row.startswith('@@'):
  m=re.match(r'@@ -(\d+)(?:,\d+)? \+(\d+)',row)
  old,new=map(int,m.groups())
 elif row.startswith('+'):
  location=(new,'RIGHT');break
 elif row.startswith('-'):
  location=(old,'LEFT');break
 elif row.startswith(' '):
  old+=1;new+=1
if not location: raise SystemExit('No first changed line found.')
body=r"""@openshift-virtualization-qe-bot-3

## Test Execution Plan

**Run smoke tests: True.** Verified path:
`tests/virt/node/general/test_container_disk_vm.py::test_container_disk_vm` (smoke) → `tests/conftest.py::autouse_fixtures` → relocated `generated_ssh_key_for_vm_access` → `ssh_key_tmpdir_scope_session` in `tests/fixtures/virt/ssh.py`.
The same autouse fixture requests `cluster_sanity_scope_session` and `cluster_sanity_scope_module` → changed `junitxml_plugin` (`hasplugin`). This affects session setup even when a test does not request a moved fixture directly.

**Run gating tests: True.** Verified paths:
- `tests/virt/cluster/common_templates/general/test_base_template.py::test_base_templates_annotations` (gating) → relocated `base_templates` → `get_base_templates_list`.
- `tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py::TestVmWithInstanceTypeAndPref::test_start_vm_with_instance_type_and_preference` (gating) → relocated `rhel_vm_with_instance_type_and_preference` → `instance_type_for_test_scope_class` / `vm_preference_for_test` → parameter-dictionary fixtures.
- Gating tests also reach the SSH-key and `junitxml_plugin` paths through `autouse_fixtures`.

**Scope**
Seven plugins replace fixtures removed from `tests/conftest.py`. Fixture scopes remain unchanged: session for SSH keys/RHEL parameters; module for templates/osinfo; class for instance types, preferences, VM actions, and most VMs; function for the existing-DV VM and one migration policy. No tests were added. No `utilities/` or `libs/` files changed.

**Affected tests to run**
All tests under `tests/` use the shared autouse setup. Run `tests/ -m smoke` and `tests/ -m gating` for that shared path. Use these targeted consumers for the moved fixture bodies:

- `tests/virt/node/general/test_container_disk_vm.py::test_container_disk_vm` (smoke; session setup and SSH).
- `tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py` (gating; all tests use moved instance-type/preference fixtures, including negative creation and resource-edit cleanup).
- `tests/virt/cluster/common_templates/general/test_base_template.py` (all tests use moved template, osinfo, or existing-DV VM fixtures; only `test_base_templates_annotations` is gating-marked).
- `tests/infrastructure/instance_types/supported_os/test_rhel_os.py::TestVMMigrationAndState::test_pause_unpause_after_migrate` (ping fixture; not smoke/gating).
- `tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py::TestCommonTemplatesRhel::test_pause_unpause_after_migrate` (ping fixture; gating inherited from the class).
  Run these pause tests with their create/start/SSH/migration prerequisites, not as isolated node IDs.
- `tests/install_upgrade_operators/must_gather/test_must_gather_vms.py::TestNoMultipleFilesCollected::test_no_multiple_empty_files_collected_from_must_gather_migrated_vm` (migration VM; repeated migration and post-yield `clean_up()`).
- `tests/install_upgrade_operators/must_gather/test_must_gather_vms.py::TestControllerRevisionCollected::test_controller_revision_collected` (cluster instance type/preference VM).
- `tests/install_upgrade_operators/must_gather/test_must_gather_vm_preferences.py::TestInstanceTypesAndPreferencesCollected::test_instancestypes_collected` (transitive resource fixtures).
- `tests/observability/metrics/test_migration_metrics.py::TestKubevirtVmiMigrationMetrics::test_kubevirt_vmi_migration_metrics` (class-scoped migration policy).
- `tests/virt/node/log_verbosity/test_log_virt_launcher.py::TestProgressOfMigrationInVirtLauncher::test_progress_of_vm_migration_in_virt_launcher_pod` (function-scoped migration policy through `migrated_vm_with_policy`).
- `tests/observability/metrics/test_vms_metrics.py::TestVmConsolesAndVmCreateDateTimestampMetrics::test_kubevirt_console_active_connections` (`vm_for_test`; console context cleanup).
- `tests/observability/metrics/test_vms_metrics.py::TestVmVnicInfo::test_metric_kubevirt_vm_vnic_info_linux` (`running_metric_vm`; cloud-init).
- `tests/observability/metrics/test_vms_metrics.py::TestVmiPhaseTransitionFromDeletion::test_kubevirt_vmi_phase_transition_from_deletion_seconds_linux` (`deleted_vmi` → `running_metric_vm`; deletion cleanup).
- `tests/observability/metrics/test_network_metrics.py::TestVmiNetworkMetricsLinux::test_kubevirt_vmi_network_traffic_bytes_total` (traffic fixtures → `vm_for_test`).
- `tests/observability/metrics/test_ssp_metrics.py::TestSSPTemplate::test_metric_kubevirt_ssp_common_templates_restored_increase` (template edit/revert).
- `tests/observability/metrics/test_ssp_metrics.py::TestSSPTemplateValidatorRejected::test_metric_kubevirt_ssp_template_validator_rejected_increase` (class-level `usefixtures` → instance-type fixture).
- `tests/virt/node/general/test_vmi_reset.py::TestVMIReset::test_reset_success` (reset fixtures → `vm_for_test`).
- `tests/virt/cluster/sysprep/test_sysprep.py` (all tests use `sysprep_vm` → instance-type fixture).
- `tests/virt/cluster/common_templates/custom_namespace/test_custom_namespace.py` (all tests reach template enumeration/edit/delete fixtures).
- `tests/infrastructure/golden_images/test_common_templates_data_volumes.py::test_vm_with_existing_dv` (existing-DV VM).
- `tests/infrastructure/golden_images/update_boot_source/test_ssp_common_templates_boot_sources.py::test_common_templates_boot_source_reference` (templates).
- `tests/infrastructure/golden_images/update_boot_source/test_ssp_data_sources.py::test_opt_out_data_source_reconciles_after_update` (data-source fixture chain → templates).
- `tests/virt/cluster/migration_and_maintenance/test_evictionstrategy.py::test_evictionstrategy_not_in_templates` (templates).
- `tests/storage/storage_migration/test_storage_class_migration.py::TestStorageClassMigrationAtoB::test_vm_storage_class_migration_a_to_b_running_vms` and `::TestStorageClassMigrationAtoB::test_migrate_vms_after_storage_migration` (dynamic `request.getfixturevalue` → template/imported-DV VM → `rhel_latest_os_params`; run both in order).
- `tests/virt/upgrade/test_upgrade_virt.py::TestUpgradeVirt::test_is_vm_running_before_upgrade` (gating; upgrade VM/data-source/DV chain → RHEL parameters).
- `tests/virt/upgrade/test_upgrade_virt.py::TestUpgradeVirt::test_golden_image_pvc_names_after_upgrade` (templates; not gating-marked).
  Run upgrade consumers in the configured upgrade lane with their prerequisite tests.

**Real tests (cluster required)**

Use the PR checkout and an authenticated, supported cluster. Set `SC` to an existing supported storage class. Use the matching architecture configuration; the example uses AMD64.

```bash
export SC=ocs-storagecluster-ceph-rbd-virtualization
```

**Refactor/discovery path**
```bash
uv run pytest tests/ --collect-only \
  --tc-file=tests/global_config_amd64.py --tc-format=python \
  --storage-class-matrix="$SC"
```
Expected: all seven plugins import and collection completes. Collection alone does **not** prove fixture setup or teardown.

**Session error/fix path: JUnit output enabled**
```bash
uv run pytest tests/virt/node/general/test_container_disk_vm.py::test_container_disk_vm \
  --tc-file=tests/global_config_amd64.py --tc-format=python \
  --storage-class-matrix="$SC" --junitxml=/tmp/virt-fixtures-junit.xml
```
Expected: no plugin-manager `AttributeError`; cluster sanity receives the JUnit callback; XML output is written; VM startup succeeds.

**Happy path: no JUnit output requested**
```bash
uv run pytest tests/virt/node/general/test_container_disk_vm.py::test_container_disk_vm \
  --tc-file=tests/global_config_amd64.py --tc-format=python \
  --storage-class-matrix="$SC"
```
Expected: `junitxml_plugin` returns `None`; session setup still succeeds. SSH-key generation and VM startup work. At teardown, the generated key file and `CNV_VM_SSH_KEY_PATH` are removed.

**Moved-fixture runtime regression**
```bash
uv run pytest \
  tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py \
  tests/virt/cluster/common_templates/general/test_base_template.py \
  tests/install_upgrade_operators/must_gather/test_must_gather_vms.py::TestNoMultipleFilesCollected::test_no_multiple_empty_files_collected_from_must_gather_migrated_vm \
  --tc-file=tests/global_config_amd64.py --tc-format=python \
  --storage-class-matrix="$SC"
```
Expected: indirect parameters resolve; osinfo downloads/extracts; VMs, preferences, instance types, and migration resources clean up after fixture scope ends. Do not add `-m gating` to this command: that would omit osinfo and repeated-migration coverage.

**Shared-path regression**
```bash
uv run pytest tests/ -m smoke \
  --tc-file=tests/global_config_amd64.py --tc-format=python \
  --storage-class-matrix="$SC"

uv run pytest tests/ -m gating \
  --tc-file=tests/global_config_amd64.py --tc-format=python \
  --storage-class-matrix="$SC"
```

**Hardware collection safety**
The moved dictionary fixture retains optional `gpus_list` and `host_devices_list` handling. Inspected consumers do not pass those fields. Repeat collection and the instance-type/preference runtime command on clusters with and without device hardware. Collection must not require GPUs or SR-IOV devices. If a downstream hardware-specific fixture supplies these fields, verify its availability guard returns `None` when hardware is absent, and run its allocation tests on a hardware-equipped cluster.

The reported 22-pass smoke runs are prior evidence. They do not establish current-head gating, osinfo, migration-cleanup, or XML-enabled runtime results. The commands above are proposed verification; they were not run in the inspection sandbox.
"""
payload={'body':body,'commit_id':meta['head']['sha'],'path':first['filename'],'line':location[0],'side':location[1]}
for attempt in range(2):
 result=subprocess.run(['gh','api','--method','POST',f'repos/{repo}/pulls/{pr}/comments','--input','-'],input=json.dumps(payload),text=True,capture_output=True)
 if result.returncode==0:
  print('Inline comment submitted.')
  raise SystemExit(0)
 print(result.stderr)
 if attempt==0: time.sleep(2)
fallback=subprocess.run(['gh','api','--method','POST',f'repos/{repo}/issues/{pr}/comments','--input','-'],input=json.dumps({'body':body}),text=True,capture_output=True)
if fallback.returncode:
 print(fallback.stderr)
 raise SystemExit(fallback.returncode)
print('Fallback PR comment submitted.')
PY

Length of output: 11415


@openshift-virtualization-qe-bot-3

Test Execution Plan

  • Run smoke tests: True. test_container_disk_vm → shared autouse_fixtures → relocated SSH-key fixtures. The shared setup also reaches the changed junitxml_plugin through cluster sanity fixtures.
  • Run gating tests: True. test_base_templates_annotations → relocated base_templates. Instance-type/preference gating tests also reach relocated VM and resource fixtures.

Targeted coverage

Run these fixture consumers in addition to smoke and gating tests:

  • tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py
  • tests/virt/cluster/common_templates/general/test_base_template.py
  • tests/install_upgrade_operators/must_gather/test_must_gather_vms.py::TestNoMultipleFilesCollected::test_no_multiple_empty_files_collected_from_must_gather_migrated_vm

Check resource cleanup after each fixture scope ends. Run pause-after-migration tests with their prerequisite tests.

Real-cluster verification

Set SC to a supported storage class.

# Plugin imports and collection
uv run pytest tests/ --collect-only \
  --tc-file=tests/global_config_amd64.py --tc-format=python \
  --storage-class-matrix="$SC"

# Session setup with JUnit output
uv run pytest tests/virt/node/general/test_container_disk_vm.py::test_container_disk_vm \
  --tc-file=tests/global_config_amd64.py --tc-format=python \
  --storage-class-matrix="$SC" --junitxml=/tmp/virt-fixtures-junit.xml

Repeat the runtime command without --junitxml for the normal path. Collection alone does not verify fixture setup or teardown. These commands were not run in the inspection sandbox.

You are interacting with an AI system.

@rnetser rnetser left a comment

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.

/approve
/lgtm

@dshchedr

dshchedr commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

/lgtm
/approve

@openshift-virtualization-qe-bot

Copy link
Copy Markdown

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants