anchore / anchore-engine

A service that analyzes docker images and scans for vulnerabilities
Apache License 2.0
1.58k stars 271 forks source link

Initial implementation of unit test coverage prioritization tool #1310

Closed dakaneye closed 2 years ago

dakaneye commented 2 years ago

We have had a hard time prioritizing how to improve our test coverage at Anchore, and that was a problem I had set out to try and make some progress on in this PR.

At first, I was cataloging our test coverage in a spreadsheet (which was super painful), and then we decided to pivot and switch to building a script that can analyze the code and spit out a list of functions that do not have unit tests and sort the list of functions in order of how much they're used across the project.

I have a v1 script completed but it is a little bit of a frankenstein. It's not great at determining usages of methods across the application (it's just doing a file keyword search right now) or in the unit test directory.....but it does help a little!

I'll be using this to start making a dent in our unit test coverage and wanted to commit it to the project so that we can continue iterating on it!

Signed-off-by: Samuel Dacanay sam.dacanay@anchore.com

dakaneye commented 2 years ago

Thanks for the review @subecho !

Agree with your points! I have multithreaded a bit of the execution (you should've seen how slow it was before that! haha). but in general the points are valid. I'll add them and merge!

dakaneye commented 2 years ago

@DaneWeber this is ready to merge for now, but not sure where you all are at regarding release timing, will let you do the actual merging! This should NOT affect any runtime engine code