search: Refactor suggestions and add integration tests for them
Created by: camdencheek
Motivation: earlier today, a change I made that touched search suggestions caused a panic in frontend that took down cloud. I identified two things that would have helped prevent that outage. First was having integration tests that covered suggestions. Even a minimal test would have caught this panic. Second was refactoring the search suggestion code so that it relied less on interface{}
so that static analysis would catch type errors.
Fixes #18621 (closed) Fixes #18622 (closed)
Overview of the changes:
- Make
SearchSuggestionResolver
an interface - Create wrapper type for each type of suggestion that implements
SearchSuggestionResolver
- Move core suggestion types into
search_suggestions.go
- Convert consumers of
newSearchSuggestionResolver
to use the wrapper types directly - Add an integration test
I apologize in advance for the large changes -- I struggled to split this one up.