Skip to content

Move RemoteRepository in to a subpackage

Sami Hiltunen requested to merge smh-subpackage-repo-implementations into master
  • This commit extracts a test suite for testing implementations of ìnternal/git.Repository. Extracting allows us to share the tests between different implementations to avoid duplicating the code and to make sure the implementations behave the same. The test suite is exported in order to have it be callable from other packages. This allows us to move the implementations in to subpackages in order to not pull their dependencies in to the high level git package. In our case, this allows us to avoid dependency cycles when testing services which depend on the git package with implementations that depend on some services.

  • RemoteRepository pulls in dependencies which are unrelated to git to the git package. This makes testing also more involved as we remote repository depends on multiple Gitaly services for its tests, which some depend on git package. This causes a dependency cycle forcing git packages tests to stay in a separate test package. This commit moves remote repository to its own subpackage to remove the dependency cycle and fixes the few call sites to use the new package. This way git package can stay agnostic to whatever implementations of Repository interface might exist.

  • In 99e95ce5, the RemoteRepository was added to the git package. RemoteRepository's tests created a cyclic dependency as they depend on Gitaly services which depend back on the git package. The tests were moved to git_test package to avoid the problem. Since then, the RemoteRepository has been moved to a subpackage which has removed the cyclic dependency between the various packages. This commit moves git packages test back to the git package.

Edited by Sami Hiltunen

Merge request reports