Skip to content
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

GR: Add test universe generation script and tests for patch generation #967

Merged
merged 2 commits into from
May 9, 2024

Conversation

michaelkedar
Copy link
Member

Made a go script that creates a universe file for the MockResolutionClient (#909) from the current real deps.dev & OSV data used during in-place / relock / relax computation.

This has let me add some real-world in-place & relax patch generation test cases to test for regression without it breaking constantly due to new versions. I've only added one universe because the files are pretty large.

The in-place/relax patch generation tests are basically end-to-end tests - it's not really written in a way that makes testing only the patch computation functionality possible. (This might be a code smell, but I don't think it's practical to structure the code in such a way).

@codecov-commenter
Copy link

codecov-commenter commented May 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.99%. Comparing base (3be8eff) to head (569e876).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #967      +/-   ##
==========================================
+ Coverage   63.71%   63.99%   +0.28%     
==========================================
  Files         146      146              
  Lines       11958    11958              
==========================================
+ Hits         7619     7653      +34     
+ Misses       3875     3853      -22     
+ Partials      464      452      -12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@michaelkedar michaelkedar added the guided remediation Related to guided remediation / osv-scanner fix label May 7, 2024
@michaelkedar michaelkedar marked this pull request as ready for review May 8, 2024 00:39
Copy link
Collaborator

@oliverchang oliverchang left a comment

Choose a reason for hiding this comment

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

this is awesome!

return clienttest.ResolutionUniverse{}, err
}
for _, r := range reqs {
// don't bother writing dev dependencies
Copy link
Contributor

Choose a reason for hiding this comment

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

How about optional dependencies?

Copy link
Member Author

Choose a reason for hiding this comment

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

npm tries to install optional dependencies if possible, so I'd like to keep them in the universe

@michaelkedar michaelkedar merged commit 5e53ae8 into google:main May 9, 2024
13 checks passed
josieang pushed a commit to josieang/osv-scanner that referenced this pull request Jun 6, 2024
google#967)

Made a go script that creates a universe file for the
`MockResolutionClient` (google#909) from the current real deps.dev & OSV data
used during in-place / relock / relax computation.

This has let me add some real-world in-place & relax patch generation
test cases to test for regression without it breaking constantly due to
new versions. I've only added one universe because the files are pretty
large.

The in-place/relax patch generation tests are basically end-to-end tests
- it's not really written in a way that makes testing only the patch
computation functionality possible. (This might be a code smell, but I
don't think it's practical to structure the code in such a way).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guided remediation Related to guided remediation / osv-scanner fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants