search: set up independent state for racy test
Created by: rvantonder
A racy test affects some PRs and builds:
FAIL: TestSearchSuggestions (0.03s) | 1m 26s
-- | --
| --- FAIL: TestSearchSuggestions/single_term (0.01s)
| testing.go:906: race detected during execution of test
| testing.go:906: race detected during execution of test
I attempted to disable it with a t.Skip
, but then the tests fails, because:
panic: unexpected state: no gitserver addresses
Turns out one of the tests didn't set up a gitserver mock state. This is probably what caused it to be racy, so this is an attempted fix. If this test still flakes, I will add a t.Skip
next (and it's possible to skip it now, unlike before this PR).