Skip to content

Fix s390x test compatibility issues#4305

Open
chandramerla wants to merge 1 commit intoRedHatQE:mainfrom
chandramerla:s390x-test-fixes
Open

Fix s390x test compatibility issues#4305
chandramerla wants to merge 1 commit intoRedHatQE:mainfrom
chandramerla:s390x-test-fixes

Conversation

@chandramerla
Copy link
Copy Markdown
Member

@chandramerla chandramerla commented Mar 30, 2026

Short description:

When trying to move to fedora43 for s390x and trying to run affected tests, have come across some issues, whose fixes are in this PR

More details:
  • Fix centos DataSource name: use os_name="centos-stream" to generate correct "centos-stream9" DataSource name instead of "centos9"
  • Add retry logic to get_ip_from_vm_or_virt_handler_pod with TimeoutSampler to handle guest agent IP reporting timing
  • Skip x86-specific clock timers (hpet, pit, kvm, hyperv, rtc) in VirtualMachinePreference fixture on s390x
  • Remove s390x marker from test_validate_clock_values (x86-only)
  • Skip EFI/OVMF preferences on s390x in common VM preference tests
  • Override nic_models_matrix for s390x to exclude unsupported e1000e
  • Remove s390x marker from test_successful_clone_of_large_image (Windows image not available for s390x)
What this PR does / why we need it:

Fixes some test issues for s390x arch.

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

Please review changes from respective files as you are more familiar or making fixes there -

  1. @aditi-sharma-1 . tests/infrastructure/instance_types/test_common_vm_preference.py , tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py, utilities/pytest_utils.py, utilities/unittests/test_pytest_utils.py

  2. @HarshithaMS005 tests/network/connectivity/test_pod_network.py , utilities/network.py

  3. @Davo911 tests/storage/cdi_clone/test_clone.py

jira-ticket:

Summary by CodeRabbit

  • Tests
    • Improved architecture-aware testing with enhanced s390x compatibility handling for VM preferences and hardware features
    • Extended test coverage for clock validation and storage clone operations across all architectures
    • Enhanced configuration support for s390x testing environments with updated NIC model specifications

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 30, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR introduces architecture-aware test handling for s390x clusters by adding conditional logic to fixtures and tests. It adds a dependency on is_s390x_cluster to conditionally skip EFI-requiring preferences and clock preferences on s390x, adds s390x-specific NIC configuration, and removes s390x test markers from previously restricted tests.

Changes

Cohort / File(s) Summary
Fixture and Configuration Updates
tests/conftest.py, tests/global_config_s390x.py
Updated common_vm_preference_param_dict fixture to depend on is_s390x_cluster and conditionally handle clock_preferred_timer (skip on s390x, emit info log). Added nic_models_matrix = ["virtio"] to s390x global config.
VM Preference Test Logic
tests/infrastructure/instance_types/test_common_vm_preference.py
Added _preference_requires_efi() helper and logging. Extended run_general_vm_preferences with is_s390x parameter to conditionally skip VM startup for EFI-requiring preferences on s390x. Updated three test functions to forward is_s390x_cluster.
Test Marker Removals
tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py, tests/storage/cdi_clone/test_clone.py
Removed @pytest.mark.s390x decorator from test_validate_clock_values and test_successful_clone_of_large_image, expanding test scope beyond s390x-only execution.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 46.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the main objective: fixing s390x architecture-specific test compatibility issues across multiple test files and utilities.
Description check ✅ Passed The description is comprehensive and well-structured, covering short summary, detailed bullet points, rationale, and reviewer assignment. However, the jira-ticket field is incomplete (empty comment marker instead of actual ticket URL or NONE).
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.

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

✨ 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-4
Copy link
Copy Markdown

Report bugs in Issues

Welcome! 🎉

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

🔄 Automatic Actions

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

📋 Available Commands

PR Status Management

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

Review & Approval

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

Testing & Validation

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

Container Operations

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

Cherry-pick Operations

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

Label Management

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

✅ Merge Requirements

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

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

📊 Review Process

Approvers and Reviewers

Approvers:

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

Reviewers:

  • Ahmad-Hafe
  • Anatw
  • EdDev
  • RoniKishner
  • azhivovk
  • dalia-frank
  • dshchedr
  • duyanyan
  • geetikakay
  • josemacassan
  • jpeimer
  • kgoldbla
  • kshvaika
  • mijankow
  • rnetser
  • servolkov
  • stesrn
  • vsibirsk
  • yossisegev
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
AI Features
  • Cherry-Pick Conflict Resolution: Enabled (claude/claude-opus-4-6[1m])

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is automatically removed on each new commit
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • Container Builds: Container images are automatically tagged with the PR number
  • Permission Levels: Some commands require approver permissions
  • Auto-verified Users: Certain users have automatic verification and merge privileges

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 30, 2026

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4305      +/-   ##
==========================================
+ Coverage   98.63%   98.66%   +0.03%     
==========================================
  Files          25       25              
  Lines        2420     2476      +56     
==========================================
+ Hits         2387     2443      +56     
  Misses         33       33              
Flag Coverage Δ
utilities 98.66% <ø> (+0.03%) ⬆️

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.

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

/retest all

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

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 #4402.

Overlapping files

tests/conftest.py

@nestoracunablanco
Copy link
Copy Markdown
Contributor

Hey @chandramerla just thinking out loud: in order to get things moving, what do you think about moving the timeout related changes to another PR?

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.

♻️ Duplicate comments (2)
tests/infrastructure/instance_types/test_common_vm_preference.py (1)

60-78: ⚠️ Potential issue | 🔴 Critical

CRITICAL: is_s390x is always False, so the EFI skip path never runs — and reviewer asked for is_s390x_cluster.

get_cluster_architecture() returns a set[str] (per utilities/architecture.py), so get_cluster_architecture() == S390X compares a set against the string "s390x" and is permanently False. The new EFI/OVMF skip block on s390x is therefore unreachable, and the test will still try to start VMs with EFI-required preferences on s390x — defeating the purpose of this PR.

rnetser asked for the existing is_s390x_cluster fixture (defined in tests/conftest.py lines 2743–2745) to be used. Since run_general_vm_preferences is a plain helper, the cleanest fix is to push the architecture check up to the test methods (which can request the fixture) and pass it down:

🔧 Suggested fix
-def run_general_vm_preferences(client, namespace, preferences):
-    is_s390x = get_cluster_architecture() == S390X
+def run_general_vm_preferences(client, namespace, preferences, is_s390x):
     for preference_name in preferences:
         # TODO remove arm64 skip when openshift-virtualization-tests support arm64
         if all(suffix not in preference_name for suffix in ["virtio", "arm64"]):
             if is_s390x and _preference_requires_efi(client=client, preference_name=preference_name):
                 LOGGER.info(f"Skipping preference {preference_name}: EFI/OVMF not available on s390x")
                 continue
             start_vm_with_cluster_preference(
                 client=client,
                 preference_name=preference_name,
                 namespace_name=namespace.name,
             )

And update each call site to request the is_s390x_cluster fixture and forward it, e.g.:

-    def test_common_vm_preference_windows(self, unprivileged_client, namespace):
+    def test_common_vm_preference_windows(self, unprivileged_client, namespace, is_s390x_cluster):
         run_general_vm_preferences(
             client=unprivileged_client,
             namespace=namespace,
             preferences=[pref for pref in VM_PREFERENCES_LIST["windows"] if pref not in {"windows.2k3", "windows.xp"}],
+            is_s390x=is_s390x_cluster,
         )

(apply analogously to test_common_vm_preference_linux and test_common_vm_preference_dpdk).

After this, the get_cluster_architecture import at line 10 and the S390X import at line 11 are no longer needed in this file.

Based on learnings, get_cluster_architecture() returns a singleton set, not a string, so equality against S390X is never true; and maintainer rnetser requested the is_s390x_cluster fixture be used instead of re-deriving the check.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/infrastructure/instance_types/test_common_vm_preference.py` around
lines 60 - 78, run_general_vm_preferences currently computes is_s390x using
get_cluster_architecture() == S390X which always yields False; move the
cluster-architecture decision into the test(s) and accept a boolean parameter
is_s390x_cluster instead of deriving it inside the helper: change
run_general_vm_preferences signature to accept is_s390x_cluster (and keep
_preference_requires_efi as-is), update callers (e.g.,
test_common_vm_preference_linux, test_common_vm_preference_dpdk,
test_common_vm_preference_windows) to request the existing is_s390x_cluster
fixture and pass it through, and then remove the now-unused
get_cluster_architecture and S390X imports from this file.
tests/conftest.py (1)

2197-2203: ⚠️ Potential issue | 🔴 Critical

CRITICAL: s390x guard is dead code — comparison can never be true, and maintainer asked for the existing fixture.

get_cluster_architecture() returns a set[str] (see utilities/architecture.py), so get_cluster_architecture() == S390X compares a set against the string "s390x" and is always False. On s390x the else branch still runs and preferredTimer (an x86-only timer) is set on the VirtualMachinePreference — exactly the failure this PR is meant to fix.

Additionally, this file already defines the canonical is_s390x_cluster fixture at lines 2743–2745, and reviewer rnetser explicitly asked for it to be used here. Wire it through the fixture parameters instead of re-implementing the check (and re-implementing it incorrectly):

🔧 Suggested fix
 `@pytest.fixture`(scope="class")
-def common_vm_preference_param_dict(request):
+def common_vm_preference_param_dict(request, is_s390x_cluster):
     common_preference_dict = {
         "name": request.param["name"],
         "client": request.param.get("client"),
         "teardown": request.param.get("teardown", True),
         "yaml_file": request.param.get("yaml_file"),
     }
     if request.param.get("clock_timezone") or request.param.get("clock_utc_seconds_offset"):
         common_preference_dict["clock"] = {
             "preferredClockOffset": {
                 "timezone": request.param.get("clock_timezone"),
                 "utc": {"offsetSeconds": request.param.get("clock_utc_seconds_offset")},
             }
         }
     if request.param.get("clock_preferred_timer"):
-        if get_cluster_architecture() == S390X:
+        if is_s390x_cluster:
             LOGGER.info(
                 "Skipping preferredTimer in VirtualMachinePreference: x86-specific timers not available on s390x"
             )
         else:
             common_preference_dict.setdefault("clock", {})["preferredTimer"] = request.param["clock_preferred_timer"]

If is_s390x_cluster is adopted, the get_cluster_architecture import added at line 77 and the S390X import on line 113 also become unused here and should be removed.

Based on learnings, get_cluster_architecture() returns a singleton set in this repo, so equality against the S390X string is never true; and maintainer rnetser requested the is_s390x_cluster fixture be used instead.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/conftest.py` around lines 2197 - 2203, Replace the broken architecture
check that compares get_cluster_architecture() to S390X with the existing
is_s390x_cluster fixture: add is_s390x_cluster as a parameter to the
fixture/function that contains the shown block, then change the condition to
only set common_preference_dict.setdefault("clock", {})["preferredTimer"] when
request.param.get("clock_preferred_timer") is truthy AND is_s390x_cluster is
False; keep the LOGGER.info branch for the s390x case. After that remove the
now-unused imports get_cluster_architecture and S390X from the top of the file.
Ensure references to request.param and common_preference_dict remain unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@tests/conftest.py`:
- Around line 2197-2203: Replace the broken architecture check that compares
get_cluster_architecture() to S390X with the existing is_s390x_cluster fixture:
add is_s390x_cluster as a parameter to the fixture/function that contains the
shown block, then change the condition to only set
common_preference_dict.setdefault("clock", {})["preferredTimer"] when
request.param.get("clock_preferred_timer") is truthy AND is_s390x_cluster is
False; keep the LOGGER.info branch for the s390x case. After that remove the
now-unused imports get_cluster_architecture and S390X from the top of the file.
Ensure references to request.param and common_preference_dict remain unchanged.

In `@tests/infrastructure/instance_types/test_common_vm_preference.py`:
- Around line 60-78: run_general_vm_preferences currently computes is_s390x
using get_cluster_architecture() == S390X which always yields False; move the
cluster-architecture decision into the test(s) and accept a boolean parameter
is_s390x_cluster instead of deriving it inside the helper: change
run_general_vm_preferences signature to accept is_s390x_cluster (and keep
_preference_requires_efi as-is), update callers (e.g.,
test_common_vm_preference_linux, test_common_vm_preference_dpdk,
test_common_vm_preference_windows) to request the existing is_s390x_cluster
fixture and pass it through, and then remove the now-unused
get_cluster_architecture and S390X imports from this file.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a1c1425c-bdbb-463a-8975-e7f680ff5709

📥 Commits

Reviewing files that changed from the base of the PR and between 7eef80e and 09fc814.

📒 Files selected for processing (7)
  • tests/conftest.py
  • tests/global_config_s390x.py
  • tests/infrastructure/instance_types/test_common_vm_preference.py
  • tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py
  • tests/network/connectivity/test_pod_network.py
  • tests/storage/cdi_clone/test_clone.py
  • utilities/network.py
💤 Files with no reviewable changes (2)
  • tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py
  • tests/storage/cdi_clone/test_clone.py

Copy link
Copy Markdown
Member Author

@chandramerla chandramerla left a comment

Choose a reason for hiding this comment

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

Thanks for the review and sorry for getting back late on this.

Now, I've addressed the review comments and testing the changes locally

Comment thread tests/infrastructure/instance_types/test_common_vm_preference.py Outdated


def run_general_vm_preferences(client, namespace, preferences):
is_s390x = get_cluster_architecture() == S390X
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

Comment thread tests/infrastructure/instance_types/test_common_vm_preference.py Outdated
Check connectivity
"""
dst_ip = get_ip_from_vm_or_virt_handler_pod(family=ip_family, vm=pod_net_running_vmb)
dst_ip = get_ip_from_vm_or_virt_handler_pod(family=ip_family, vm=pod_net_running_vmb, wait_timeout=TIMEOUT_90SEC)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

AFAIR I've seen this when running the tests locally - not getting the IP always probably as during startup it takes some time to initialize.

Anyway reverted from this PR for now. I will cross check if this is required and raise a separate PR if it is the case, with more details.

Comment thread tests/conftest.py Outdated
}
if request.param.get("clock_preferred_timer"):
common_preference_dict.setdefault("clock", {})["preferredTimer"] = request.param["clock_preferred_timer"]
if get_cluster_architecture() == S390X:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

addressed

- Fix centos DataSource name: use os_name="centos-stream" to generate
  correct "centos-stream9" DataSource name instead of "centos9"
- Skip x86-specific clock timers (hpet, pit, kvm, hyperv, rtc) in
  VirtualMachinePreference fixture on s390x
- Remove s390x marker from test_validate_clock_values (x86-only)
- Skip EFI/OVMF preferences on s390x in common VM preference tests
- Override nic_models_matrix for s390x to exclude unsupported e1000e
- Remove s390x marker from test_successful_clone_of_large_image
  (Windows image not available for s390x)

Made-with: Cursor
@openshift-virtualization-qe-bot-3
Copy link
Copy Markdown
Contributor

Clean rebase detected — no code changes compared to previous head (ad85037).
The following labels were preserved: commented-coderabbitai[bot], lgtm-coderabbitai[bot].

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

/retest all

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

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 #4725.

Overlapping files

tests/global_config_s390x.py

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

/retest all

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

Overlapping files

tests/storage/cdi_clone/test_clone.py

@dshchedr
Copy link
Copy Markdown
Collaborator

dshchedr commented May 4, 2026

/lgtm

@servolkov
Copy link
Copy Markdown
Contributor

@chandramerla thanks, please, update the PR description to match the PR content. After you recent fixes some of the lines should be deleted, like "Fix centos DataSource name" and "Add retry logic to get_ip_from_vm_or_virt_handler_pod".

Also please don't forget to add verified label with the description what was done to verify the PR.

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.