test(api): test automation for the Remediation endpoint - #1204
Open
matejnesuta wants to merge 5 commits into
Open
test(api): test automation for the Remediation endpoint#1204matejnesuta wants to merge 5 commits into
matejnesuta wants to merge 5 commits into
Conversation
Contributor
Reviewer's GuideAdds end-to-end API tests for the Remediations behavior of POST /api/v3/vulnerability/analyze, validating remediation categories, URLs, data payloads, multi-remediation behavior, and version range handling against synthetic CSAF advisory data. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The
findSyntheticPurlStatushelper usesRecord<string, any>and inline object casts; consider introducing a lightweight response type interface so the test assertions remain type-safe and easier to refactor. - Several long string literals (purls, details text, URLs) are duplicated between the dataset and tests; centralizing these in a shared fixture or constants file would reduce brittleness if the synthetic data changes.
- The
communityPurlfields inremediationCasesare currently unused; if they are not needed for future assertions, remove them to avoid confusion, or add a test that explicitly validates the community PURL behavior.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `findSyntheticPurlStatus` helper uses `Record<string, any>` and inline object casts; consider introducing a lightweight response type interface so the test assertions remain type-safe and easier to refactor.
- Several long string literals (purls, details text, URLs) are duplicated between the dataset and tests; centralizing these in a shared fixture or constants file would reduce brittleness if the synthetic data changes.
- The `communityPurl` fields in `remediationCases` are currently unused; if they are not needed for future assertions, remove them to avoid confusion, or add a test that explicitly validates the community PURL behavior.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1204 +/- ##
=======================================
Coverage 54.13% 54.13%
=======================================
Files 255 255
Lines 5715 5715
Branches 1774 1774
=======================================
Hits 3094 3094
Misses 2356 2356
Partials 265 265
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR contains API tests for the Remediation feature.
Related Issues
https://redhat.atlassian.net/browse/TC-3755
Type of Change
Tests
Summary by Sourcery
Add end-to-end API tests for vulnerability remediation responses, covering all remediation categories and version range behavior.
Tests: