Skip to content

Add support for multiarch dedicated tests#5124

Merged
vsibirsk merged 6 commits into
RedHatQE:mainfrom
hmeir:multiarch-infra
Jul 7, 2026
Merged

Add support for multiarch dedicated tests#5124
vsibirsk merged 6 commits into
RedHatQE:mainfrom
hmeir:multiarch-infra

Conversation

@hmeir

@hmeir hmeir commented Jun 3, 2026

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

Adds infrastructure support for running tests on heterogeneous (multi-architecture) clusters with both amd64 and arm64 worker nodes. Three run configurations are now supported:

  • --cpu-arch=amd64 / --cpu-arch=arm64 — regression run scoped to one architecture's nodes
  • --cpu-arch=amd64,arm64 — multiarch-dedicated run for tests that require multiple architectures simultaneously
Which issue(s) this PR fixes:
  • Setup failure when cpu_arch > 1.
  • Collection failure when cpu_arch > 1.
  • MULTIARCH.md not informative enough
Special notes for reviewer:

The .get() calls on parametrize decorator values are intentional — because collection with cpu_arch > 1 failes because of import order.

jira-ticket:

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

Summary by CodeRabbit

  • New Features
    • Added multi-architecture-aware pytest test collection filtering (with deselection reporting) and a new pytest-check-multiarch tox environment.
  • Bug Fixes
    • Reduced KeyError failures by safely handling missing image/OS and architecture values during test setup.
    • Improved architecture-based node selection and clarified cluster CPU architecture output.
  • Documentation
    • Rewrote the multiarch guide with clearer run modes, requirements, and test authoring rules.
  • Tests
    • Expanded coverage for multiarch filtering and multi-architecture environment parsing.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds collection-time multiarch test filtering, makes CPU-architecture handling optional in fixtures and helpers, updates several tests to avoid missing-key failures with .get(), and expands multiarch documentation plus tox coverage.

Changes

Multiarch collection and marker wiring

Layer / File(s) Summary
Collection filtering and marker wiring
utilities/pytest_utils.py, conftest.py, tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_images_support.py, utilities/unittests/test_pytest_utils.py
filter_multiarch_tests filters multiarch items on homogeneous clusters, root collection calls it, the multiarch golden-image module is marked, and tests cover passthrough plus deselection behavior.

Architecture-aware fixtures and safe parametrization

Layer / File(s) Summary
Optional CPU architecture fixtures
tests/conftest.py, utilities/architecture.py, utilities/unittests/test_architecture.py
schedulable_nodes now takes explicit architecture input when present, cluster_info formats architecture output differently, and comma-separated cluster architecture values are parsed as a set.
Safe RHEL and CPU arch parametrization
tests/chaos/oadp/test_oadp.py, tests/storage/cdi_upload/test_upload.py, tests/storage/cdi_upload/test_upload_virtctl.py, tests/storage/golden_image/test_golden_image.py, tests/virt/node/high_performance_vm/test_high_performance_templates.py
Several parametrizations switch from direct dictionary indexing to .get() lookups for RHEL metadata and cpu_arch values.

Documentation and CI coverage

Layer / File(s) Summary
Multiarch docs, tox, and collection checks
docs/MULTIARCH.md, tox.ini
The multiarch guide now describes run modes, constraints, and test-authoring rules, and tox adds a collection-only multiarch environment that exercises per-arch and multiarch collection paths.

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

Possibly related PRs

Suggested labels: new-tests

Suggested reviewers: rnetser, dshchedr, vsibirsk, RoniKishner, yossisegev

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, under 120 characters, and accurately reflects the multiarch dedicated test support added by this PR.
Description check ✅ Passed All required template sections are present, including purpose, issues, reviewer notes, and a Jira ticket link.
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 diff only modifies existing test files; no new test files or new test_* functions under tests/ were added, so traceability links aren’t required.
✨ 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.

@openshift-virtualization-qe-bot-2

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

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:

  • dshchedr
  • jpeimer
  • myakove
  • rnetser
  • vsibirsk

Reviewers:

  • Ahmad-Hafe
  • RoniKishner
  • SamAlber
  • acinko-rh
  • akri3i
  • dalia-frank
  • dshchedr
  • ema-aka-young
  • geetikakay
  • josemacassan
  • jpeimer
  • kgoldbla
  • kshvaika
  • rnetser
  • sarahbx
  • vsibirsk
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.

@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.68%. Comparing base (a2dc143) to head (4656d10).
⚠️ Report is 213 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5124   +/-   ##
=======================================
  Coverage   98.67%   98.68%           
=======================================
  Files          25       42   +17     
  Lines        2487     2501   +14     
=======================================
+ Hits         2454     2468   +14     
  Misses         33       33           
Flag Coverage Δ
utilities 98.68% <100.00%> (+<0.01%) ⬆️

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.

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

🤖 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 `@utilities/pytest_utils.py`:
- Around line 624-633: Add a Google-style docstring to the public function
remove_tests_from_list explaining its purpose (filtering pytest.Item objects by
a keyword), describing parameters (items: list[pytest.Item] and filter_str: str)
and the return value (tuple of discard_tests and items_to_return as lists of
pytest.Item), and include any important behavior details such as that membership
is checked via "filter_str in item.keywords" and the ordering of returned lists
mirrors input order; place the docstring immediately above the def
remove_tests_from_list(...) declaration.
- Around line 635-642: Add a Google-style docstring to the public function
filter_multiarch_tests explaining its purpose (filters out or returns multiarch
tests depending on cluster type), its parameters (items: list[pytest.Item],
config: pytest.Config), and its return value (list[pytest.Item]); mention
behavior when py_config.get("cluster_type") == MULTIARCH and that it calls
remove_tests_from_list and may invoke config.hook.pytest_deselected with
discarded tests. Ensure the docstring is placed immediately below the def line
and follows Google docstring sections: Args and Returns.
🪄 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: 9a47eda7-a39f-430d-9af5-5e47da246cc7

📥 Commits

Reviewing files that changed from the base of the PR and between c0e6a28 and 3f48e93.

📒 Files selected for processing (9)
  • conftest.py
  • tests/chaos/oadp/test_oadp.py
  • tests/conftest.py
  • tests/storage/cdi_upload/test_upload.py
  • tests/storage/cdi_upload/test_upload_virtctl.py
  • tests/storage/golden_image/test_golden_image.py
  • tests/storage/test_disk_preallocation.py
  • tests/virt/node/high_performance_vm/test_high_performance_templates.py
  • utilities/pytest_utils.py

Comment thread utilities/pytest_utils.py Outdated
Comment thread utilities/pytest_utils.py
@hmeir

hmeir commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

/verified

@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"

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Tip

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

@openshift-virtualization-qe-bot-3, I already posted the full Test Execution Plan for this PR as an inline review comment on docs/MULTIARCH.md (line 3) earlier in this thread, covering:

  • Smoke tests: True — via tests/storage/cdi_upload/test_upload_virtctl.pyschedulable_nodes fixture (signature/behavior changed in tests/conftest.py) and the new filter_multiarch_tests collection hook.
  • Gating tests: Truetests/storage/golden_image/test_golden_image.py, tests/virt/node/high_performance_vm/test_high_performance_templates.py, tests/storage/cdi_upload/test_upload_virtctl.py, tests/network/connectivity/test_pod_network.py, tests/virt/node/general/test_linux_label.py.
  • The full affected-tests table and concrete pytest --collect-only commands for both the fix path (homogeneous cluster deselecting multiarch-marked tests) and the happy-path regression.

Since that comment, the activity in this thread (/retest all reruns, the "Clean rebase detected — no code changes" event, and the auto-triggered retests due to overlaps with unrelated merged PRs #5320, #5285, #5323) does not indicate any new diff changes to this PR itself. That plan remains applicable as-is.

If there have been actual code changes to this PR since that comment (beyond rebases/retests), let me know or push a new commit and I'll regenerate the plan against the latest diff.

Also, a quick note unrelated to testing: rnetser asked to "fix codecov" — that's still outstanding and worth addressing before merge.

[skip_review_follow_up_policy]

@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

/retest all

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

Overlapping files

conftest.py
tests/conftest.py
utilities/architecture.py
utilities/pytest_utils.py
utilities/unittests/test_pytest_utils.py

hmeir added 6 commits July 6, 2026 09:36
Currently, only one cpu arch can be passed without failing.
for multiarch tests, we need to iterate over cluster archs.

Signed-off-by: Harel Meir <hmeir@redhat.com>
Collection fails because of re-import.
Transitioning to get method

Signed-off-by: Harel Meir <hmeir@redhat.com>
Signed-off-by: Harel Meir <hmeir@redhat.com>
Signed-off-by: Harel Meir <hmeir@redhat.com>
Signed-off-by: Harel Meir <hmeir@redhat.com>
Signed-off-by: Harel Meir <hmeir@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: 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 `@utilities/pytest_utils.py`:
- Around line 652-673: The multiarch validation path in filter_multiarch_tests
is currently unreachable because pytest_collection_modifyitems removes multiarch
items before validate_collected_tests_arch_params runs. Either move the
cluster_type check earlier so homogeneous clusters are validated before
deselection, or remove the dead py_config["cluster_type"] != MULTIARCH branch
from validate_collected_tests_arch_params and keep the behavior limited to
filtering in filter_multiarch_tests.
🪄 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: 28fd7f71-5b57-4888-a224-ffa73c00f0f7

📥 Commits

Reviewing files that changed from the base of the PR and between 0fdad7e and 4656d10.

📒 Files selected for processing (14)
  • conftest.py
  • docs/MULTIARCH.md
  • tests/chaos/oadp/test_oadp.py
  • tests/conftest.py
  • tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_images_support.py
  • tests/storage/cdi_upload/test_upload.py
  • tests/storage/cdi_upload/test_upload_virtctl.py
  • tests/storage/golden_image/test_golden_image.py
  • tests/virt/node/high_performance_vm/test_high_performance_templates.py
  • tox.ini
  • utilities/architecture.py
  • utilities/pytest_utils.py
  • utilities/unittests/test_architecture.py
  • utilities/unittests/test_pytest_utils.py

Comment thread utilities/pytest_utils.py
@hmeir

hmeir commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

/verified

@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"

@coderabbitai

coderabbitai Bot commented Jul 6, 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 pr view 5124 --repo RedHatQE/openshift-virtualization-tests --json headRefOid,updatedAt,commits --jq '{head: .headRefOid, updated: .updatedAt, lastCommits: [.commits[-3:][] | {oid: .oid, messageHeadline: .messageHeadline, committedDate: .committedDate}]}'

Length of output: 941


@openshift-virtualization-qe-bot-3, the Test Execution Plan I posted earlier (inline comment on docs/MULTIARCH.md, line 3) remains current. The overlap with merged PR #5440 (conftest.py, tests/conftest.py, utilities/architecture.py, utilities/pytest_utils.py, utilities/unittests/test_pytest_utils.py) is against files already part of this PR's own diff and already covered in that plan — the /retest all trigger and rebase did not introduce new functional changes to PR #5124 itself (head is now 4656d10918008296fe162720ce52a365fa18f6ad, with the last three commits being "Add multiarch unnitest", "Updated README and cluster_info", and "Add tox check for multiarch," none of which alter the previously analyzed fixture/utility behavior).

I won't repost a duplicate inline comment. If a future push introduces new functional changes to this PR (beyond doc/tox/test additions), ping me again and I'll regenerate the plan against that diff.

@openshift-virtualization-qe-bot-3

Copy link
Copy Markdown
Contributor

/retest all

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

Overlapping files

tests/conftest.py
tests/storage/golden_image/test_golden_image.py

@OhadRevah

Copy link
Copy Markdown
Contributor

/lgtm

@rnetser

rnetser commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

/approve
/lgtm

@openshift-virtualization-qe-bot

Copy link
Copy Markdown

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

@hmeir

hmeir commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

/cherry-pick cnv-4.22

@openshift-virtualization-qe-bot-2

Copy link
Copy Markdown
Contributor

Manual cherry-pick is needed
Cherry pick failed for bd4fb7c to cnv-4.22:
To cherry-pick run:

git remote update
git checkout cnv-4.22
git pull origin cnv-4.22
git checkout -b multiarch-infra-cnv-4.22
git cherry-pick bd4fb7ccedc6bdbfb6ccbf588d7d3743deaa556d
# If the above fails with 'is a merge but no -m option', run:
# git cherry-pick -m 1 bd4fb7ccedc6bdbfb6ccbf588d7d3743deaa556d
git push origin multiarch-infra-cnv-4.22

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.