search: make integration testing easy and clear
Created by: ijt
I would like to test the sourcegraph search system to see that it gets expected results for given sets of repos and queries. This currently involves either manual work tearing down and setting up repos in the local dev instance or writing unit tests that have a bunch of mocks.
An alternative approach would be to add a new command, say dev/srcsearch
, that runs the entire search system within a single process. This command could be used for manual testing, like this:
$ srcsearch --fakes=repos.json 'func main'
<graphql output for the query 'func main' on the given repositories>
The repos.json
file could look like
[
{ "name": "user1/project1", files: { "a.go": "...", "b.go": "..." } },
...
]
This command could have its own readable tests that would effectively be integration tests of sourcegraph search, with the added benefit that we would be able to see meaningful code coverage stats from them since everything would run in a single process.
This would help with #1005 (closed).