osv-scanner icon indicating copy to clipboard operation
osv-scanner copied to clipboard

test: introduce a special "cherry-picking" mock server for providing local databases

Open G-Rath opened this issue 10 months ago • 0 comments

Currently the CLI tests for the local databases are the slowest as they involve downloading zip files multiple times and the databases in particular include ones like Debian and OSS-Fuzz which are the largest of the lot - with the TestRun_LocalDatabases cases included, the suite takes about 90 seconds to run, whereas without it it takes less than 30 seconds.

This attempts to improve the performance of our test suite by introducing a mocking server that acts like the GCP storage bucket which serves in-memory zip files containing specific OSVs for each ecosystem that have been "cherry-picked", which brings us back to around the 30 second mark.

Aside from the downside of this being a fake GCP storage bucket (which is technically a downside, but I doubt the behaviour of GCP storage is going to change significantly enough to make this an actual risk), this does mean we miss out on testing both the zip-based databases and the specific OSVs they contain.

On the other hand, this does mean we shouldn't have to update snapshots as often since we control exactly what OSVs are included in the checks.

Resolves #1567

G-Rath avatar Feb 11 '25 02:02 G-Rath