Skip to content

database: Remove database.Mocks.ExternalServices

Administrator requested to merge rs/externalservice-mock into main

Created by: ryanslade

The ValidateConfig method was extracted from the ExternalServiceStore and renamed to ValidateExternalServiceConfig.

Instead, it is now a function that takes the store as a parameter. This allows us to mock the store functions using our new mocking system and allows us to remove the global database.Mocks.externalServices.

Because we have custom validators when running in enterprise mode the validation function is exposed as a variable so that we can swap in different implementations. This is similar to we had before where the store constructor was exposed as a variable.

Once all of the above refactoring was done, the external service mock could be removed.

Best viewed with whitespace ignored.

Test plan

All tests still pass after the refactor.

Closes https://github.com/sourcegraph/sourcegraph/issues/32380

Merge request reports

Loading