IUO: featuregates tests should consider multiarch and v1beta1 api#4744
IUO: featuregates tests should consider multiarch and v1beta1 api#4744hmeir wants to merge 1 commit intoRedHatQE:mainfrom
Conversation
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis 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. ChangesFeature-Gates Testing Refactor
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)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
AI Features
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
There was a problem hiding this comment.
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
📒 Files selected for processing (5)
tests/conftest.pytests/install_upgrade_operators/conftest.pytests/install_upgrade_operators/constants.pytests/install_upgrade_operators/feature_gates/conftest.pytests/install_upgrade_operators/feature_gates/test_default_featuregates.py
| @pytest.fixture() | ||
| def cdi_feature_gates(cdi_resource_scope_function): | ||
| return cdi_resource_scope_function.instance.spec.config.get("featureGates") |
There was a problem hiding this comment.
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>
|
/retest all Auto-triggered: Files in this PR were modified by merged PR #4658. Overlapping filestests/install_upgrade_operators/conftest.py |
Short description:
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