Skip to content

feat(info_collector): add test to fetch versions for tools in cluster - #997

Open
silvi-t wants to merge 2 commits into
Kuadrant:mainfrom
silvi-t:tools-version-collection
Open

feat(info_collector): add test to fetch versions for tools in cluster#997
silvi-t wants to merge 2 commits into
Kuadrant:mainfrom
silvi-t:tools-version-collection

Conversation

@silvi-t

@silvi-t silvi-t commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Important

This PR modifies shared/core testsuite code that could potentially affect multiple test areas. 2 reviewers should review this PR to ensure adequate coverage.

Description

  • Add test_tools_properties collector test that resolves actual deployed versions of tools (e.g. keycloak:latestkeycloak:26.4.11) by querying container registry APIs
  • Add container_image_versions.py module with ContainerRegistryResolver that matches image digests from pod status against semver tags in quay.io, ghcr.io, and Red Hat Catalog
  • Extract image digests from status.containerStatuses[].imageID via new get_pod_images() method

Changes

New Features

  • testsuite/container_image_versions.py: New module with ContainerRegistryResolver class that resolves container image digests to semver version tags via registry APIs (quay.io, ghcr.io, Red Hat Catalog)
  • testsuite/tests/info_collector.py: New test_tools_properties test that collects images from the tools namespace, resolves :latest tags to actual versions, and records them as Report Portal launch attributes
  • testsuite/tests/info_collector.py: New _resolve_tools_versions() helper that skips resolution for images already tagged with semver and falls back gracefully on failure

Modifications

  • testsuite/component_metadata.py: Refactored get_component_images() into get_pod_images() which additionally extracts image digests from pod status.containerStatuses; get_component_images() now wraps
    get_pod_images() for backwards compatibility
  • testsuite/tests/info_collector.py: Filtered testsuite-pipelines-tools from test_kuadrant_properties output as it is a CI tool, not a Kuadrant component

Verification steps

  1. Run the collector:
    make collect
  2. Check junit-00-collect.xml for resolved tools versions
  3. Optionally import into Report Portal and verify the tools version attributes:
rptool write junit-00-collect.xml

Summary by CodeRabbit

  • Bug Fixes

    • Improved component image details when tags are missing, ensuring consistent name/tag/image reporting.
    • Updated pod image collection warnings for clearer wording.
    • Made Istio metadata extraction more resilient to missing version attributes.
  • Tests

    • Added coverage for reporting selected tools component images across clusters, excluding pipeline tooling images.
    • Added coverage for recording tools and cert-manager operator subscription version details.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 027e476d-cbc0-4fcc-b752-b69a5ee6f254

📥 Commits

Reviewing files that changed from the base of the PR and between 4f374b4 and 26479c1.

📒 Files selected for processing (2)
  • testsuite/component_metadata.py
  • testsuite/tests/info_collector.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • testsuite/tests/info_collector.py
  • testsuite/component_metadata.py

📝 Walkthrough

Walkthrough

Component image parsing now preserves untagged images with empty tags and safely handles missing Istio version attributes. Information collection excludes pipeline-tool images and records selected tools images plus operator subscription versions as Report Portal properties.

Changes

Tool metadata property reporting

Layer / File(s) Summary
Normalised component and Istio metadata
testsuite/component_metadata.py
get_component_images consistently returns (name, tag, image) tuples, updates pod-image warning wording, and ignores missing Istio version attributes.
Tools and operator property collection
testsuite/tests/info_collector.py
Kuadrant pipeline-tool images are skipped; selected tools images and operator subscription versions are collected and recorded as unique properties.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant test_tools_properties
  participant ReportPortalMetadataCollector
  participant record_testsuite_property
  test_tools_properties->>ReportPortalMetadataCollector: collect tools component images
  ReportPortalMetadataCollector-->>test_tools_properties: image name, tag, full image
  test_tools_properties->>record_testsuite_property: record unique tool properties
  test_tools_properties->>record_testsuite_property: record unique operator version properties
Loading

Possibly related PRs

Suggested reviewers: averevki

Poem

A rabbit hops through tools with care,
Sorting images everywhere.
Empty tags and versions shine,
Properties neatly fall in line.
“Hop hooray!” the records grow.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is conventional and accurately summarises the main change of collecting tools versions in cluster.
Description check ✅ Passed The PR description includes Description, Changes, and Verification sections and is mostly complete.
Docstring Coverage ✅ Passed Docstring coverage is 85.00% which is sufficient. The required threshold is 80.00%.
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.
✨ 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.

@silvi-t
silvi-t requested a review from a team June 10, 2026 12:38
@silvi-t silvi-t self-assigned this Jun 10, 2026

@azgabur azgabur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Its not yet the case, but when releasing we will want to have all versions pinned when deploying kuadrant
Kuadrant/helm-charts-olm#80
Kuadrant/helm-charts-olm#88

So a simple collecting without resolving should be sufficient.

Keycloak version should be checked from CSV field "installedCSV" not from catalog.redhat.com as it is bit disconnected from what is on cluster.

Signed-off-by: Silvia Tarabova <starabov@redhat.com>
@silvi-t
silvi-t force-pushed the tools-version-collection branch from 40ca7f8 to 4f374b4 Compare July 21, 2026 13:26

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 `@testsuite/component_metadata.py`:
- Around line 140-142: Update component metadata collection in
testsuite/component_metadata.py at lines 140-142 and 180-182: add inner
AttributeError handling around sub.model.status.installedCSV and
istio[0].model.spec.version, respectively. Skip the affected subscription when
status is unavailable, and preserve the Istio fallback logic so istiod pod
labels and images are still collected when spec.version is missing.
🪄 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: 52b3e33a-b81a-45d1-9b1b-74f2a6b2231f

📥 Commits

Reviewing files that changed from the base of the PR and between 54c10a7 and 4f374b4.

📒 Files selected for processing (2)
  • testsuite/component_metadata.py
  • testsuite/tests/info_collector.py

Comment thread testsuite/component_metadata.py Outdated
@silvi-t

silvi-t commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Its not yet the case, but when releasing we will want to have all versions pinned when deploying kuadrant Kuadrant/helm-charts-olm#80 Kuadrant/helm-charts-olm#88

So a simple collecting without resolving should be sufficient.

Keycloak version should be checked from CSV field "installedCSV" not from catalog.redhat.com as it is bit disconnected from what is on cluster.

@azgabur agreed — since tools can be now deployed with pinned version tags (helm-charts-olm#80, helm-charts-olm#88), I've removed the ContainerRegistryResolver entirely and simplified the collection:

  • test_tools_properties reads version tags directly from pod images in the tools namespace for version-frozen tools (jaeger, redis, dragonfly, valkey) — no registry API calls needed
  • test_tools_operator_properties reads Subscription.status.installedCSV for OLM-managed operators (keycloak/rhbk-operator from tools namespace, cert-manager from cert-manager-operator namespace) and parses the version from the CSV name (e.g. rhbk-operator.v26.6.4-opr.1v26.6.4-opr.1)

@silvi-t
silvi-t force-pushed the tools-version-collection branch from 4f374b4 to 4b90907 Compare July 21, 2026 13:39
@silvi-t
silvi-t requested a review from azgabur July 21, 2026 13:40
Comment thread testsuite/component_metadata.py Outdated
Comment thread testsuite/component_metadata.py Outdated
Comment thread testsuite/tests/info_collector.py
  Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Signed-off-by: Silvia Tarabova <starabov@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants