Skip to content

IUO: featuregates tests should consider multiarch and v1beta1 api#4744

Open
hmeir wants to merge 1 commit intoRedHatQE:mainfrom
hmeir:hco-fix-fg-tests
Open

IUO: featuregates tests should consider multiarch and v1beta1 api#4744
hmeir wants to merge 1 commit intoRedHatQE:mainfrom
hmeir:hco-fix-fg-tests

Conversation

@hmeir
Copy link
Copy Markdown
Contributor

@hmeir hmeir commented May 5, 2026

Short description:

Fix featuregates failuers

More details:
  1. Use v1beta1.
  2. Align with multiarch FG enabled by multiarch deployments.
  3. Add jira reference for misconfiguration in deployments.
What this PR does / why we need it:

Green runs on iuo lanes

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

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

Summary by CodeRabbit

  • Tests
    • Added multi-architecture cluster detection to test suite.
    • Introduced fixtures to read CDI feature gates and to track an open issue state (CNV-86639).
    • Updated expected-value logic to conditionally enable/disable specific feature gates based on multi-arch status and issue state.
    • Simplified default feature-gates tests to assert values directly via resource-specific fixtures.
  • Chores
    • Introduced a named constant for the multi-arch boot-image-import feature gate.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds multi-architecture cluster detection and refactors feature-gates tests. It introduces an is_multi_arch_cluster fixture, a new ENABLE_MULTI_ARCH_BOOT_IMAGE_IMPORT constant used in defaults, fixtures that expose CDI feature-gates and Jira CNV-86639 state, and simplifies tests to retrieve FEATUREGATES via fixture names.

Changes

Multi-architecture and Jira-conditional feature-gates

Layer / File(s) Summary
Cluster Detection
tests/conftest.py
Imports get_cluster_architecture and adds session-scoped is_multi_arch_cluster() fixture returning True when len(get_cluster_architecture()) > 1.
Feature-gate Constants
tests/install_upgrade_operators/constants.py
Defines ENABLE_MULTI_ARCH_BOOT_IMAGE_IMPORT constant as "enableMultiArchBootImageImport" and includes it in HCO_DEFAULT_FEATUREGATES with FG_DISABLED default.
Fixture Infrastructure
tests/install_upgrade_operators/conftest.py
Adds cdi_feature_gates fixture exposing CDI featuregates; introduces jira_86639_open session fixture for issue CNV-86639; updates expected_value fixture to accept is_multi_arch_cluster and jira_86639_open and conditionally merge feature-gate overrides.
Test Refactoring
tests/install_upgrade_operators/feature_gates/test_default_featuregates.py
Removes resource object construction and config-based imports; adds hco_featuregates fixture; updates test_default_featuregates_by_resource to parametrize over fixture names and retrieve featuregates via request.getfixturevalue().

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The pull request description provides sections for short description and more details, but lacks sufficient specificity in several required sections and contains incomplete information. Expand 'More details' with specific technical changes. Clarify which issue the PR fixes by providing issue number/link in 'Which issue(s) this PR fixes' section instead of leaving it blank.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main objectives: adding multiarch consideration and v1beta1 API support to featuregates tests.
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
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
  • 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.

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 `@tests/install_upgrade_operators/conftest.py`:
- Around line 158-160: The fixture cdi_feature_gates assumes
cdi_resource_scope_function.instance.spec.config exists; add a guard that checks
instance and instance.spec and instance.spec.config before accessing it and fail
fast with a clear, contextual error (e.g., using pytest.fail or raising
RuntimeError) if any are None; reference the fixture name cdi_feature_gates and
the accessed symbol cdi_resource_scope_function.instance.spec.config in the
message and include what was expected vs actual (e.g., "expected spec.config
dict, got None for instance <instance identifier or instance>") so callers get
specific context.
🪄 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: 708ff4db-2e1f-4e94-aa3c-667b4f494690

📥 Commits

Reviewing files that changed from the base of the PR and between 968a40a and ff63bbc.

📒 Files selected for processing (5)
  • tests/conftest.py
  • tests/install_upgrade_operators/conftest.py
  • tests/install_upgrade_operators/constants.py
  • tests/install_upgrade_operators/feature_gates/conftest.py
  • tests/install_upgrade_operators/feature_gates/test_default_featuregates.py

Comment thread tests/install_upgrade_operators/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 #4658.

Overlapping files

tests/install_upgrade_operators/conftest.py

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

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

1. Use v1beta1.
2. Align with multiarch FG enabled by multiarch deployments.
3. Add jira reference for misconfiguration in deployments.

Signed-off-by: Harel Meir <hmeir@redhat.com>
@hmeir hmeir force-pushed the hco-fix-fg-tests branch from f53bc51 to af8cb06 Compare May 7, 2026 17:48
@openshift-virtualization-qe-bot-2
Copy link
Copy Markdown
Contributor

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

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 `@tests/install_upgrade_operators/conftest.py`:
- Around line 292-295: The PR template currently lacks a meaningful "##### What
this PR does / why we need it:" section; update the PR description (or template
used for this repo) to restore that heading and add concrete reviewer-facing
context: state the problem being solved, the behavior change introduced, and why
the change is required (traceability/impact), and ensure this appears for
changes touching tests like the jira_86639_open fixture in
tests/install_upgrade_operators/conftest.py so reviewers can quickly understand
intent and rationale.
🪄 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: 2d923ac0-ff60-4adf-9553-0357d2ad4b1b

📥 Commits

Reviewing files that changed from the base of the PR and between f53bc51 and af8cb06.

📒 Files selected for processing (4)
  • tests/conftest.py
  • tests/install_upgrade_operators/conftest.py
  • tests/install_upgrade_operators/constants.py
  • tests/install_upgrade_operators/feature_gates/test_default_featuregates.py

Comment thread tests/install_upgrade_operators/conftest.py
@hmeir
Copy link
Copy Markdown
Contributor Author

hmeir commented May 7, 2026

/verified

Ran the whole featuregate suite on multiarch cluster.

@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 Test Execution Plan with the smoke tests recommendation.
Do NOT submit a formal review - just post the inline comment directly.

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, and fixture inheritance
  5. Detect new tests introduced in the PR
  6. Smoke Test Impact Analysis: Determine if any changes could affect smoke tests by checking:
    • Changes to files/functions used by tests marked with @pytest.mark.smoke
    • Changes to fixtures or utilities imported by smoke tests
    • Changes to conftest.py files that may affect smoke test execution
    • Changes to core infrastructure code (utilities/, libs/) that smoke tests depend on

Your deliverable:
Your change request comment will be based on the following requirements:

Test Execution Plan

  • Run smoke tests: True / False (Based on your smoke test impact analysis - True if any changes may affect smoke tests)
  • 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 specific marker(s) can be used to cover multiple cases.

Guidelines:

  • Include only tests directly affected by the changes
  • Use a full file path only if ALL tests in that file require verification
  • Use file path + test name if only specific tests are needed
  • If a test marker can cover multiple files/tests, provide the marker
  • Balance coverage vs over-testing - Keep descriptions minimal

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 an inline review 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 submitting the review fails 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: Before setting "Run smoke tests: True", you MUST use shell scripts to:
- Trace the actual fixture dependency chain from smoke tests to changed fixtures
- Verify that smoke tests actually import/use changed utilities or functions
- Confirm the dependency path exists; do NOT assume based on scope or semantics
- Be conservative: Session-scoped fixtures or infrastructure-sounding names do NOT
automatically mean smoke test impact. Only flag smoke test impact when you can
demonstrate a concrete dependency path.
WRONG: "This session-scoped storage fixture might affect smoke tests"
RIGHT: "Smoke test X uses fixture Y, which depends on the changed fixture Z"

Comment thread tests/conftest.py
from libs.net.ip import filter_link_local_addresses, random_ipv4_address, random_ipv6_address
from libs.net.vmspec import lookup_iface_status
from tests.utils import download_and_extract_tar
from utilities.architecture import get_cluster_architecture
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Test Execution Plan

Run smoke tests: False

No concrete dependency path found from any @pytest.mark.smoke test to the changed fixtures (is_multi_arch_cluster, expected_value, cdi_feature_gates, jira_86639_open).


Tests to run:

  • tests/install_upgrade_operators/feature_gates/test_default_featuregates.py
    Full file — test refactored (new fixture-based parametrization via featuregates_fixture, new hco_featuregates fixture, removed resource_object_value_by_key)

  • tests/install_upgrade_operators/feature_gates/test_featuregate_reconcile.py::TestHardcodedFeatureGates::test_managed_cr_featuregate_reconcile
    Uses expected_value fixture (indirect), which now conditionally adds ENABLE_MULTI_ARCH_BOOT_IMAGE_IMPORT and DISABLE_MDEV_CONFIGURATION based on is_multi_arch_cluster / jira_86639_open


Note: Run on both a multi-arch cluster and a single-arch cluster to validate the conditional logic in expected_value for ENABLE_MULTI_ARCH_BOOT_IMAGE_IMPORT.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find smoke tests and check if they depend on changed fixtures
echo "=== Smoke tests using is_multi_arch_cluster ==="
rg -n "is_multi_arch_cluster" --type py

echo ""
echo "=== Smoke tests in conftest files ==="
rg -n "pytest.mark.smoke" tests/conftest.py tests/install_upgrade_operators/conftest.py 2>/dev/null || echo "No smoke marks in conftest files"

echo ""
echo "=== Smoke tests that use expected_value fixture ==="
rg -n "expected_value" --type py -C2

echo ""
echo "=== All smoke-marked tests ==="
rg -rn "@pytest.mark.smoke" tests/install_upgrade_operators/ --type py

echo ""
echo "=== First changed lines in tests/conftest.py (git diff) ==="
git diff origin/main...HEAD -- tests/conftest.py | head -40

echo ""
echo "=== CDI feature gates fixture usages ==="
rg -n "cdi_feature_gates\|jira_86639" --type py

echo ""
echo "=== is_multi_arch_cluster usages in smoke tests ==="
rg -rn "pytest.mark.smoke" tests/ --type py -l | xargs grep -l "is_multi_arch_cluster" 2>/dev/null || echo "No smoke tests use is_multi_arch_cluster"

echo ""
echo "=== Feature gate test file structure ==="
cat tests/install_upgrade_operators/feature_gates/test_default_featuregates.py

Length of output: 58030


🏁 Script executed:

#!/bin/bash
# Get the PR diff to find the exact commit SHA for the inline comment
gh pr view 4744 --repo RedHatQE/openshift-virtualization-tests --json headRefOid -q '.headRefOid'

# Also check the changed files list and line numbers for the PR
gh api repos/RedHatQE/openshift-virtualization-tests/pulls/4744/files --jq '.[].filename' | head -10

Length of output: 223


🏁 Script executed:

#!/bin/bash
# Post inline review comment on the first changed line of tests/conftest.py
gh api repos/RedHatQE/openshift-virtualization-tests/pulls/4744/reviews \
  --method POST \
  --field commit_id="af8cb0642f3ab15244e53236345b753b897c3a78" \
  --field body="" \
  --field event="COMMENT" \
  --field "comments[][path]=tests/conftest.py" \
  --field "comments[][position]=4" \
  --field "comments[][body]=## Test Execution Plan

**Run smoke tests: False**
> No concrete dependency path found from any \`@pytest.mark.smoke\` test to the changed fixtures (\`is_multi_arch_cluster\`, \`expected_value\`, \`cdi_feature_gates\`, \`jira_86639_open\`).

---

### Tests to run:

- \`tests/install_upgrade_operators/feature_gates/test_default_featuregates.py\`
  Full file — test refactored (new fixture-based parametrization via \`featuregates_fixture\`, new \`hco_featuregates\` fixture, removed \`resource_object_value_by_key\`)

- \`tests/install_upgrade_operators/feature_gates/test_featuregate_reconcile.py::TestHardcodedFeatureGates::test_managed_cr_featuregate_reconcile\`
  Uses \`expected_value\` fixture (indirect), which now conditionally adds \`ENABLE_MULTI_ARCH_BOOT_IMAGE_IMPORT\` and \`DISABLE_MDEV_CONFIGURATION\` based on \`is_multi_arch_cluster\` / \`jira_86639_open\`

---

> **Note:** Run on both a **multi-arch cluster** and a **single-arch cluster** to validate the conditional logic in \`expected_value\` for \`ENABLE_MULTI_ARCH_BOOT_IMAGE_IMPORT\`."

Length of output: 1735


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.

6 participants