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:
  1. Use v1beta1.
  2. Align with multiarch FG enabled by multiarch deployments.
  3. Add jira reference for misconfiguration in deployments.
More details:
What this PR does / why we need it:
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 infrastructure for improved environment validation.
    • Enhanced feature gates testing with streamlined fixtures and improved test organization.
    • Strengthened automatic feature gate configuration for multi-architecture boot image support and cluster-specific conditions.
    • Refactored feature gates validation tests for better maintainability.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

Warning

Rate limit exceeded

@hmeir has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 45 minutes and 10 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: dc5e19a6-bd8b-4cdb-b89e-783f8b0a7158

📥 Commits

Reviewing files that changed from the base of the PR and between ff63bbc and 7a8eb73.

📒 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
📝 Walkthrough

Walkthrough

This PR refactors feature-gates testing to support multi-architecture cluster detection and Jira issue status checking. New fixtures provide cluster architecture and Jira issue detection, feature-gates constants are introduced, and the main test is refactored to use indirect fixture lookups instead of direct resource object construction.

Changes

Feature-Gates Testing Refactor

Layer / File(s) Summary
Foundation Fixtures
tests/conftest.py
Added session-scoped is_multi_arch_cluster() fixture that checks len(get_cluster_architecture()) > 1 to determine multi-arch support.
Jira & Conditional Logic
tests/install_upgrade_operators/conftest.py
Added jira_86639_open session fixture using is_jira_open("CNV-86639"). Updated expected_value fixture to accept is_multi_arch_cluster and jira_86639_open parameters, conditionally enabling ENABLE_MULTI_ARCH_BOOT_IMAGE_IMPORT and DISABLE_MDEV_CONFIGURATION feature gates in HCO_DEFAULT_FEATUREGATES based on cluster state and Jira status.
Feature-Gates Constants
tests/install_upgrade_operators/constants.py
Added ENABLE_MULTI_ARCH_BOOT_IMAGE_IMPORT = "enableMultiArchBootImageImport" constant and included it in HCO_DEFAULT_FEATUREGATES as FG_DISABLED.
Feature-Gates Extraction Fixtures
tests/install_upgrade_operators/feature_gates/conftest.py, tests/install_upgrade_operators/conftest.py
Added hco_featuregates fixture to extract HCO feature gates from hco_spec[FEATUREGATES]. Added cdi_feature_gates fixture to extract CDI feature gates from cdi_resource_scope_function.instance.spec.config.featureGates.
Test Refactoring
tests/install_upgrade_operators/feature_gates/test_default_featuregates.py
Replaced direct resource object construction with indirect fixture-based lookups. Updated parametrization to use fixture names ("hco_featuregates", "cdi_feature_gates", "kubevirt_feature_gates") resolved via request.getfixturevalue(). Simplified imports by removing OCP resource classes and utilities. Assertion logic remains unchanged except for normalizing list results to set.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Rationale: The changes involve new fixtures at multiple levels with conditional logic, a refactored test using indirect parametrization, and coordinated updates across 5 files. While each change is straightforward, reviewers must verify: (1) the architectural detection logic is correct, (2) the conditional feature-gates enablement logic applies to the right constants in the right scenarios, (3) the indirect fixture lookup refactoring preserves test behavior, and (4) all cross-file dependencies are properly wired.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% 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 description provides a short summary of the three key objectives but lacks substantive detail on motivation, implementation approach, and context needed for code review. Expand the 'More details' and 'What this PR does / why we need it' sections to explain the rationale, implementation details, and how the changes align with multiarch deployments.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly reflects the main changes: updating feature-gates tests to consider multi-arch clusters and v1beta1 API usage.
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 on lines +158 to +160
@pytest.fixture()
def cdi_feature_gates(cdi_resource_scope_function):
return cdi_resource_scope_function.instance.spec.config.get("featureGates")
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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

HIGH: Fail fast with context when CDI spec.config is missing.

Line 160 assumes cdi_resource_scope_function.instance.spec.config is always present. If it is None, this raises an unhelpful AttributeError and obscures the root cause.

Suggested fix
 `@pytest.fixture`()
 def cdi_feature_gates(cdi_resource_scope_function):
-    return cdi_resource_scope_function.instance.spec.config.get("featureGates")
+    cdi_config = cdi_resource_scope_function.instance.spec.config
+    assert cdi_config is not None, "CDI spec.config is missing; cannot read featureGates defaults"
+    return cdi_config.get("featureGates")

As per coding guidelines: "Exception handling: error messages must be specific - include what failed, expected vs actual, and resource context."

🧰 Tools
🪛 Ruff (0.15.12)

[warning] 158-158: Use @pytest.fixture over @pytest.fixture()

Remove parentheses

(PT001)

🤖 Prompt for 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.

In `@tests/install_upgrade_operators/conftest.py` around lines 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.

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

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.

5 participants