Skip to content

Change registration of the gitaly services on the gRPC server

Pavlo Strokov requested to merge ps-gitaly-service-init-refactoring into master

Current project structure sometimes causes us a circular dependency issues. The main reason of it is RegisterAll function in the internal/gitaly/service package. It is a package on a higher level that imports packages from the deeper levels, like internal/gitaly/service/blob, etc. It is not an issue for the production code, but it causes troubles in the tests. The solution used so far to deal with it is to use a separate package '_test' for the tests. Other than that the old server setup doesn't use production code for the initialisation. With RunGitalyServer helper we re-use production code for gRPC server setup and can register only required services on it. The dependencies services relies on could be overwritten with the optional parameters. All dependencies assembled into a single struct Dependencies for that purpose as well as to reduce amount of parameters to pass into the function call. The access to the dependencies is done via a GetXXX methods, so it is easy to replace it with an interface and whatever implementation afterwards.

Merge request reports