Skip to content

Remove global gitserver.DefaultClient

Administrator requested to merge ao/gitserver-drop-global-client into main

Created by: sashaostrikov

Global gitserver.DefaultClient is deleted, gitserver.NewClient function should be used instead. It will allow creating a client ad-hoc, and injecting it with a database connection.

Due to removal of global client, testing became harder to do, because there is no way I can think about which will give me an opportunity to modify gitserver clients which are now created "on the fly".

Please pay attention to this commit, which illustrates my way of fixing the problem. main_test.go used to directly create a global test client with arbitrary l.Addr().String() addresses. Which is not really feasible now, because the client is created ad-hoc and addresses are taken from configuration, which is empty for such tests (here is why)

Test plan

Check that there are no failing tests introduced

Merge request reports

Loading