-
Notifications
You must be signed in to change notification settings - Fork 35
test: create more tests for image_index #1398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
JimFuller-RedHat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you might consider adding document_id to the test assert as that is the main (stable) indicator) when we transition to external document in the returned REST API results, otherwise LGTM
|
@sourcery-ai review |
Reviewer's GuideThis PR refactors UID handling in cyclonedx external tests by introducing a reusable split_uid helper, updates the existing product-component test to use it, enriches imports for analysis queries and JSON assertions, and adds a comprehensive image-index-variant test leveraging AnalysisService and serde_json subset assertions. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ctron - I've reviewed your changes - here's some feedback:
- Remove the debug
println!("{json:#?}")from the test to avoid cluttering CI logs. - Add an explicit assertion on
result.len()before callingsplit_uidso failures in item count yield clearer errors than a panic. - The deeply nested JSON
contains_subsetassertion is brittle—consider extracting the expected structure into a constant or using more focused assertions on key fields for clarity and maintainability.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Remove the debug `println!("{json:#?}")` from the test to avoid cluttering CI logs.
- Add an explicit assertion on `result.len()` before calling `split_uid` so failures in item count yield clearer errors than a panic.
- The deeply nested JSON `contains_subset` assertion is brittle—consider extracting the expected structure into a constant or using more focused assertions on key fields for clarity and maintainability.
## Individual Comments
### Comment 1
<location> `modules/fundamental/tests/sbom/cyclonedx/external/rh.rs:67` </location>
<code_context>
+
+ let json = serde_json::to_value(comp_index.items)?;
+
+ println!("{json:#?}");
+
+ assert!(json.contains_subset(json!([
</code_context>
<issue_to_address>
Consider removing or gating debug print statements in tests.
`println!` can clutter CI logs. Remove it or guard with a feature flag or environment variable if only needed for local debugging.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Summary by Sourcery
Add comprehensive tests for CycloneDX image index variant relationships and streamline UID handling in SBOM tests.
Enhancements:
Tests: