Skip to content

Support multi-arch cpu_arch in py_config and schedulable_nodes#4972

Closed
hmeir wants to merge 1 commit into
RedHatQE:mainfrom
hmeir:iuo-multi-arch-automation
Closed

Support multi-arch cpu_arch in py_config and schedulable_nodes#4972
hmeir wants to merge 1 commit into
RedHatQE:mainfrom
hmeir:iuo-multi-arch-automation

Conversation

@hmeir
Copy link
Copy Markdown
Contributor

@hmeir hmeir commented May 25, 2026

What this PR does / why we need it:

Enable py_config and collection infrastructure to handle multi-arch
cluster runs with `--cpu-arch=amd64,arm64'.

Which issue(s) this PR fixes:
  • Store cpu_arch as list in py_config for multi-arch runs so fixtures can read declared architectures
  • Fix schedulable_nodes to normalize cpu_arch to list and use in
    membership check (handles both str and list[str])
  • Add filter_multiarch_tests to deselect multiarch-marked tests on
    homogeneous clusters (fixes pytest-check-x86 tox collection failure)
  • Update cluster info log to display comma-separated architectures
Special notes for reviewer:

Multiarch doc says:

On clusters where nodes have different CPU architectures, you must pass --cpu-arch to select the architecture for the run. Use a single value (e.g. --cpu-arch=amd64) or, for tests marked with multiarch, a comma-separated list (e.g. --cpu-arch=amd64,arm64). Use the config file tests/global_config_multiarch.py and the multiarch marker for tests that run across multiple architectures. Do not pass --cpu-arch on homogeneous clusters.

jira-ticket:

NONE

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

Warning

Review limit reached

@hmeir, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 56 minutes and 11 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b6c36b97-c37b-476a-82f1-93efdd0fe212

📥 Commits

Reviewing files that changed from the base of the PR and between 9cb127d and bad1bb3.

📒 Files selected for processing (2)
  • conftest.py
  • tests/conftest.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-virtualization-qe-bot-5
Copy link
Copy Markdown

Report bugs in Issues

Welcome! 🎉

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

🔄 Automatic Actions

  • Reviewer Assignment: Reviewers are automatically assigned based on the OWNERS file in the repository root
  • Size Labeling: PR size labels (XS, S, M, L, XL, XXL) are automatically applied based on changes
  • Issue Creation: A tracking issue is created for this PR and will be closed when the PR is merged or closed
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified
  • Labels: Enabled categories: branch, can-be-merged, cherry-pick, has-conflicts, hold, needs-rebase, size, verified, wip

📋 Available Commands

PR Status Management

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

Review & Approval

  • /lgtm - Approve changes (looks good to me)
  • /approve - Approve PR (approvers only)
  • /assign-reviewers - Assign reviewers based on OWNERS file
  • /assign-reviewer @username - Assign specific reviewer
  • /check-can-merge - Check if PR meets merge requirements

Testing & Validation

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

Container Operations

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

Cherry-pick Operations

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

Label Management

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

✅ Merge Requirements

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

  1. Approval: /approve from at least one approver
  2. LGTM Count: Minimum 2 /lgtm from reviewers
  3. Status Checks: All required status checks must pass
  4. No Blockers: No wip, hold, has-conflicts labels and PR must be mergeable (no conflicts)
  5. Verified: PR must be marked as verified

📊 Review Process

Approvers and Reviewers

Approvers:

  • dshchedr
  • myakove
  • rnetser
  • vsibirsk

Reviewers:

  • OhadRevah
  • RoniKishner
  • albarker-rh
  • dshchedr
  • geetikakay
  • hmeir
  • rlobillo
  • rnetser
  • 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
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4972      +/-   ##
==========================================
- Coverage   98.67%   98.66%   -0.02%     
==========================================
  Files          25       25              
  Lines        2487     2465      -22     
==========================================
- Hits         2454     2432      -22     
  Misses         33       33              
Flag Coverage Δ
utilities 98.66% <100.00%> (-0.02%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 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/install_upgrade_operators/hco_enablement_golden_image_updates/conftest.py`:
- Around line 132-136: The fixture default_common_templates_related_resources
currently declares worker_architectures as a direct parameter, but
worker_architectures is only defined in the multiarch/conftest and thus not
available to sibling tests; either move the worker_architectures fixture into
tests/install_upgrade_operators/hco_enablement_golden_image_updates/conftest.py
so it’s globally available to those tests, or remove worker_architectures from
default_common_templates_related_resources’ signature and instead fetch it at
runtime inside that fixture (use request.getfixturevalue("worker_architectures")
with a try/except to handle the case where it’s not present) so the fixture no
longer has an unresolved dependency. Ensure you update
default_common_templates_related_resources to reference worker_architectures
only when successfully obtained.

In
`@tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/conftest.py`:
- Around line 33-34: The test currently patches
hyperconverged_resource_scope_class.spec.FEATURE_GATES by assigning a map with
only ENABLE_MULTI_ARCH_BOOT_IMAGE_IMPORT which can remove other gates; instead
update/merge the existing featureGates map so only
ENABLE_MULTI_ARCH_BOOT_IMAGE_IMPORT is changed. Locate
hyperconverged_resource_scope_class and the places that set FEATURE_GATES (lines
referencing FEATURE_GATES and ENABLE_MULTI_ARCH_BOOT_IMAGE_IMPORT) and change
the patch logic to read the existing spec.featureGates, copy/merge it,
set/override ENABLE_MULTI_ARCH_BOOT_IMAGE_IMPORT to the desired boolean, then
write back the merged map so other gates are preserved.
- Around line 29-119: All new pytest fixtures in this file lack type hints; add
proper typing annotations for parameters and return values (and import needed
names from typing) so they comply with mypy strict rules. Specifically, annotate
disabled_multiarch_feature_gate and enabled_multiarch_feature_gate as returning
Iterator[None] (or Generator[None, None, None]), worker_architectures as
returning Set[str], control_plane_architecture with the appropriate return type
from get_control_plane_architecture (e.g., str), single_arch_node_placement as
Iterator[None], and both hco_with_custom_unsupported_arch_template and
hco_with_custom_no_arch_annotation_template with the correct Iterator/Generator
return type; also add type annotations to their parameters (e.g., admin_client,
hco_namespace, hyperconverged_resource_scope_function, etc.) where those fixture
types are known. Ensure you import typing names (Iterator, Generator, Set) and
any project-specific types used for fixtures.
- Line 71: Before computing single_arch from worker_architectures, guard against
an empty list to avoid a bare IndexError: add an explicit check/assert that
worker_architectures is not empty and raise a clear error (e.g., AssertionError
or ValueError with a descriptive message about missing worker architectures or
cluster/setup failure) before calling sorted(worker_architectures)[0]; this
change should be applied around the single_arch assignment in conftest.py where
worker_architectures is used.

In
`@tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/utils.py`:
- Line 49: The deletion of template["status"] can raise KeyError when the key is
absent; update the removal to be safe by using a conditional or a safe pop
(e.g., check "if 'status' in template: del template['status']" or use
template.pop('status', None)) so that the code in utils.py that manipulates the
template variable no longer hard-fails when status is missing.
🪄 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: 09db8301-cdeb-4dfb-81cb-b600adc0b48f

📥 Commits

Reviewing files that changed from the base of the PR and between a380c66 and f0f9c71.

📒 Files selected for processing (13)
  • tests/conftest.py
  • tests/install_upgrade_operators/constants.py
  • tests/install_upgrade_operators/crypto_policy/constants.py
  • tests/install_upgrade_operators/hco_enablement_golden_image_updates/conftest.py
  • tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/conftest.py
  • tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/test_multiarch_golden_images_support.py
  • tests/install_upgrade_operators/hco_enablement_golden_image_updates/multiarch/utils.py
  • tests/install_upgrade_operators/hco_enablement_golden_image_updates/test_custom_golden_images_namespace.py
  • tests/install_upgrade_operators/hco_enablement_golden_image_updates/utils.py
  • utilities/hco.py
  • utilities/monitoring.py
  • utilities/pytest_utils.py
  • utilities/unittests/test_pytest_utils.py

Comment thread tests/install_upgrade_operators/hco_enablement_golden_image_updates/conftest.py Outdated
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 25, 2026
Copy link
Copy Markdown
Collaborator

@rnetser rnetser left a comment

Choose a reason for hiding this comment

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

such PRs should be split to smaller ones:

  1. refactor - moving code to be reused
  2. add additional py_config data
  3. new tests

Comment thread conftest.py
Comment on lines +562 to +568
def filter_multiarch_tests(items: list[Item], config: Config) -> list[Item]:
if py_config.get("cluster_type") == MULTIARCH:
return items
discard_tests, items_to_return = remove_tests_from_list(items=items, filter_str="multiarch")
if discard_tests:
config.hook.pytest_deselected(items=discard_tests)
return items_to_return
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.

@hmeir please move, as commented by coderabbit, to pytest_utils.

Comment thread tests/conftest.py
Comment thread utilities/pytest_utils.py Outdated
cpu_arch = cpu_arch_option.split(",") if cpu_arch_option else list(get_cluster_architecture())

if len(cpu_arch) > 1:
py_config["cpu_arch"] = cpu_arch # stored as list for multiarch runs
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.

py_config["cpu_arch"] is expected to be a sting; it cannot be set here as a list

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 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 `@conftest.py`:
- Line 36: The PR description template used in conftest.py is missing required
headings; update the template or PR-body generation logic (where MULTIARCH is
referenced) to restore these exact sections: "##### What this PR does / why we
need it:" (must contain meaningful content or fail the check), "##### Which
issue(s) this PR fixes:", "##### Special notes for reviewer:", and "#####
jira-ticket:"; ensure the generator populates or enforces non-empty content for
the first heading and that the validation check treats absence as HIGH severity.
🪄 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: f451c589-dff3-4fa0-a10f-b2962f925dc8

📥 Commits

Reviewing files that changed from the base of the PR and between 64dcc7d and 9cb127d.

📒 Files selected for processing (4)
  • conftest.py
  • tests/conftest.py
  • utilities/pytest_utils.py
  • utilities/unittests/test_pytest_utils.py

Comment thread conftest.py
Store cpu_arch as list in py_config for multi-arch runs. Fix
schedulable_nodes to normalize cpu_arch to list and use 'in' membership
check. Update cluster info log to handle list cpu_arch display.

Signed-off-by: Harel Meir <hmeir@redhat.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Comment thread conftest.py
Comment on lines +562 to +568
def filter_multiarch_tests(items: list[Item], config: Config) -> list[Item]:
if py_config.get("cluster_type") == MULTIARCH:
return items
discard_tests, items_to_return = remove_tests_from_list(items=items, filter_str="multiarch")
if discard_tests:
config.hook.pytest_deselected(items=discard_tests)
return items_to_return
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.

not addressed

Comment thread tests/conftest.py
Comment thread tests/conftest.py
f"\tCNI type: {get_cluster_cni_type(admin_client=admin_client)}\n"
f"\tWorkers type: {workers_type}\n"
f"\tCluster CPU Architecture: {nodes_cpu_architecture}\n"
f"\tCluster CPU Architecture: {nodes_cpu_architecture or ', '.join(sorted(get_cluster_architecture()))}\n"
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.

why not use py_config["cluster_arch"]?

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

/retest all

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

Overlapping files

tests/conftest.py

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

/retest all

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

Overlapping files

conftest.py

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

/retest all

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

Overlapping files

tests/conftest.py

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.

7 participants