refactor(go-website): implement non-datastore dev server for testing - #5843
Conversation
7bcafe9 to
5197390
Compare
3f0ff83 to
5197390
Compare
| pageSize = 16 | ||
| } | ||
|
|
||
| // Cursor and legacy pagination |
There was a problem hiding this comment.
Hm? why do we need legacy pagination here. Is this just the best way to paginate locally?
There was a problem hiding this comment.
If so please update the comment explaining why.
There was a problem hiding this comment.
We do the new pagination first, the legacy pagination is just 1 line of code which we might as well add for feature parity.
Added a small comment.
| // models.VulnerabilitySearchStore Implementation | ||
| // ========================================================================= | ||
|
|
||
| func (ds *DevStore) Search(_ context.Context, query models.VulnerabilitySearchQuery) (*models.VulnerabilitySearchResult, error) { |
There was a problem hiding this comment.
as far as I can tell this doesn't search for repos names (this is something datastore indexes)
There was a problem hiding this comment.
Added simple matching to repo names.
Really, this search matching is a database implementation detail, and will probably be done differently again with postgres, so I'm not too concerned on 1-to-1 matching the behaviour.
This serves the same function as
run-website-emulator, but doing it with implementations of theXyzStoreinterfaces to read and serve vulnerability JSON files from disk.This way, we can test the website without needed to spin up the datastore (and gcs) emulator, and without having to populate every datastore tables.
The vuln json files (and metadata yaml files) should be able to be hot-loaded, which should make testing easier.
The code assumes that aliases, upstream, related are all fully computed in the vulnerability JSON - it does not the the transitive alias/upstream calculations.
Stack created with GitHub Stacks CLI • Give Feedback 💬