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

test: add cases for output functions #937

Merged
merged 6 commits into from May 24, 2024
Merged

Conversation

G-Rath
Copy link
Collaborator

@G-Rath G-Rath commented Apr 23, 2024

This introduces a set of crafted scanner results that each supported output format is run through to showcase how they look across all the different results possible from a scanner run - it originally started life as the tests for #889 but I realised they could base used more generally for testing and reviewing all the outputters, so here we are.

It looks like this has also revealed the SARIF output is unstable in its ordering, which I'll aim to address in a dedicated PR

@G-Rath
Copy link
Collaborator Author

G-Rath commented Apr 23, 2024

This is ready for review but #938 should be merged first.

Note that beyond the usual review of the technical implementation, reviewers should also review the test cases to make sure they're correct for the real world and are complete, and also review the snapshots for each outputs for any oddentities that we might want to change (for which dedicated issues should be created - they won't be addressed in this PR)

@another-rex another-rex requested review from josieang and removed request for josieang April 30, 2024 04:55
@G-Rath G-Rath force-pushed the test-outputs branch 2 times, most recently from 3d16a73 to 75150a5 Compare April 30, 2024 23:55
@G-Rath G-Rath marked this pull request as draft April 30, 2024 23:57
@codecov-commenter
Copy link

codecov-commenter commented Apr 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.94%. Comparing base (9fee150) to head (e277400).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #937      +/-   ##
==========================================
+ Coverage   63.71%   63.94%   +0.22%     
==========================================
  Files         146      146              
  Lines       11958    11958              
==========================================
+ Hits         7619     7646      +27     
+ Misses       3875     3854      -21     
+ Partials      464      458       -6     

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

oliverchang pushed a commit that referenced this pull request May 3, 2024
This stabilizes the order in the SARIF output so that it is
deterministic, as #937 proved it was not.
another-rex pushed a commit that referenced this pull request May 6, 2024
These got included in #938 even though they're for #937 and it seems
that `go-snaps` does not error about this even though it will clean them
up if run with `UPDATE_SNAPS=clean`.
@G-Rath G-Rath marked this pull request as ready for review May 6, 2024 03:08
@G-Rath
Copy link
Collaborator Author

G-Rath commented May 6, 2024

fwiw the coverage output for this looks even better after #961 is landed, as it means we've got 100% coverage across most files in the package 😄

Copy link
Collaborator

@another-rex another-rex left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@another-rex another-rex merged commit 33e7f93 into google:main May 24, 2024
12 of 13 checks passed
@G-Rath G-Rath deleted the test-outputs branch May 24, 2024 05:25
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.

None yet

3 participants