fix: collect launch properties when some cluster lacks Kuadrant#983
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughCollectors now use public cluster configurations and consult KubernetesClient.is_reachable and ocp_version. component_metadata includes disconnected-project placeholders and includes images without tags. Tests and fixtures were changed to iterate configured clusters/namespaces and record per-cluster properties, skipping missing namespaces. ChangesCluster metadata and test routing
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
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 `@testsuite/tests/conftest.py`:
- Around line 429-433: The openshift_version function returns None immediately
if project.change_project("default") is not connected; update it to try a
namespace fallback before returning None: after obtaining project =
testconfig["control_plane"]["cluster"].change_project("default"), if not
project.connected iterate available namespaces (e.g., from
testconfig["control_plane"]["cluster"] or
testconfig["control_plane"]["namespaces"]) and call change_project(namespace)
until you find a connected project; once a connected project is found continue
with the existing version detection logic in openshift_version, otherwise return
None.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4b235959-c13d-435e-95f6-9b4fad93e867
📒 Files selected for processing (3)
testsuite/component_metadata.pytestsuite/tests/conftest.pytestsuite/tests/info_collector.py
Signed-off-by: Silvia Tarabova <starabov@redhat.com>
0e89998 to
abad3a7
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
testsuite/tests/conftest.py (1)
48-50: 💤 Low valueConsider using a pytest marker instead of filename matching.
Bypassing skip/fail logic by checking
item.fspath.basename == "info_collector.py"works but is fragile—renaming the file or adding similar collector tests would require changes here. A dedicated marker (e.g.,@pytest.mark.skip_capability_check) would be more explicit and maintainable.That said, given the targeted scope of this fix and the likelihood of only one such file, this is acceptable for now.
🤖 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 `@testsuite/tests/conftest.py` around lines 48 - 50, Replace the brittle filename check that looks for item.fspath.basename == "info_collector.py" with a pytest marker-based guard: check whether the test item has a marker (e.g., "skip_capability_check") using item.get_closest_marker or item.iter_markers, and skip/return when that marker is present; also update the corresponding test (info_collector.py) to be decorated with `@pytest.mark.skip_capability_check` so the new marker-based logic in conftest.py (replacing the item.fspath.basename check) correctly identifies and excludes that test.
🤖 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.
Nitpick comments:
In `@testsuite/tests/conftest.py`:
- Around line 48-50: Replace the brittle filename check that looks for
item.fspath.basename == "info_collector.py" with a pytest marker-based guard:
check whether the test item has a marker (e.g., "skip_capability_check") using
item.get_closest_marker or item.iter_markers, and skip/return when that marker
is present; also update the corresponding test (info_collector.py) to be
decorated with `@pytest.mark.skip_capability_check` so the new marker-based logic
in conftest.py (replacing the item.fspath.basename check) correctly identifies
and excludes that test.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c82d7df1-68c7-4561-89db-7d3c6a7a74f3
📒 Files selected for processing (4)
testsuite/component_metadata.pytestsuite/kubernetes/client.pytestsuite/tests/conftest.pytestsuite/tests/info_collector.py
🚧 Files skipped from review as they are similar to previous changes (1)
- testsuite/tests/info_collector.py
Signed-off-by: Silvia Tarabova <starabov@redhat.com>
Brief summary of changes
|
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 `@testsuite/tests/info_collector.py`:
- Around line 90-107: The loop over _all_cluster_projects never records a
kube_context for the first usable cluster; add logic so that when you encounter
the first cluster where project is not None you append a single ("kube_context",
cluster_name) entry to properties (or call _record_unique with that pair) and
mark it done so it only records once; update the loop that references
cluster_name, cluster, project (and uses
ReportPortalMetadataCollector.get_kubernetes_version, _record_unique,
record_testsuite_property) to set this flag and add the kube_context tuple
before continuing to collect versions.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7c7d5c24-adab-4476-ba7b-3adb7a45ae73
📒 Files selected for processing (2)
testsuite/component_metadata.pytestsuite/tests/info_collector.py
Signed-off-by: Silvia Tarabova <starabov@redhat.com>
Description
has_kuadrant()check, and theopenshift_versionfixture cascaded a failure through theclusterfixture (which requires thekuadrantnamespace)make collect/ info_collector more resilient: properties are now scraped from the first cluster that has the required components, so we still get records from the remaining clustersnot installedinstead of being omittedChanges
Bug Fixes
has_kuadrant()check inpytest_runtest_setupforinfo_collector.py— it handles missing components gracefully via try/exceptopenshift_versionfixture from theclusterfixture by connecting to thedefaultnamespace instead, so OCP version detection works regardless of thekuadrantnamespaceEnhancements
_first_connected()helper ininfo_collector.pythat iterates all configured clusters and returns the first(cluster_client, project)pair with a connected namespacegather_cluster_versions(),test_kube_context,test_kuadrant_properties, andtest_istio_propertiesto fall back to secondary clusters when the first lackskuadrant-systemoristio-system_collect_single_clusterincomponent_metadata.pyto fall back to thedefaultnamespace and reportkuadrant_image: not installedfor clusters missing KuadrantVerification steps
kuadrant_image: not installedfor clusters missing KuadrantSummary by CodeRabbit
New Features
Bug Fixes