Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2023-09-18 11:36:35 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2023-09-19 09:51:43 +0300
commit6b700f087809d4cc8e6ce901751ef5df7ba1841f (patch)
tree46609e494133e4f1aa6265a6ef6120b9ce6457dd /internal/gitaly/service/ref
parent0c64aeeef171df62628ee25049d11e0a542870e4 (diff)
service: Simplify injection of dependencies for Hook server
While we already have a `service.Dependencies` type around for quite a long time, we still pass in dependencies explicitly when constructing the actual server. This makes it harder than necessary to make a server require more dependencies as you will have to adjust all callsites where the server is currently getting constructed. Simplify the code to instead inject the `service.Dependencies` type into the server directly. This will allow us to propagate dependencies more readily in the future.
Diffstat (limited to 'internal/gitaly/service/ref')
-rw-r--r--internal/gitaly/service/ref/delete_refs_test.go8
-rw-r--r--internal/gitaly/service/ref/testhelper_test.go8
2 files changed, 2 insertions, 14 deletions
diff --git a/internal/gitaly/service/ref/delete_refs_test.go b/internal/gitaly/service/ref/delete_refs_test.go
index 2eec6b652..6ec7ead6a 100644
--- a/internal/gitaly/service/ref/delete_refs_test.go
+++ b/internal/gitaly/service/ref/delete_refs_test.go
@@ -107,13 +107,7 @@ func TestDeleteRefs_transaction(t *testing.T) {
addr := testserver.RunGitalyServer(t, cfg, func(srv *grpc.Server, deps *service.Dependencies) {
gitalypb.RegisterRefServiceServer(srv, NewServer(deps))
gitalypb.RegisterRepositoryServiceServer(srv, repository.NewServer(deps))
- gitalypb.RegisterHookServiceServer(srv, hookservice.NewServer(
- deps.GetHookManager(),
- deps.GetLocator(),
- deps.GetGitCmdFactory(),
- deps.GetPackObjectsCache(),
- deps.GetPackObjectsLimiter(),
- ))
+ gitalypb.RegisterHookServiceServer(srv, hookservice.NewServer(deps))
}, testserver.WithTransactionManager(txManager))
cfg.SocketPath = addr
diff --git a/internal/gitaly/service/ref/testhelper_test.go b/internal/gitaly/service/ref/testhelper_test.go
index e35c925b6..c64ff480a 100644
--- a/internal/gitaly/service/ref/testhelper_test.go
+++ b/internal/gitaly/service/ref/testhelper_test.go
@@ -47,13 +47,7 @@ func setupRefService(tb testing.TB) (config.Cfg, gitalypb.RefServiceClient) {
func runRefServiceServer(tb testing.TB, cfg config.Cfg) string {
return testserver.RunGitalyServer(tb, cfg, func(srv *grpc.Server, deps *service.Dependencies) {
gitalypb.RegisterRefServiceServer(srv, NewServer(deps))
- gitalypb.RegisterHookServiceServer(srv, hookservice.NewServer(
- deps.GetHookManager(),
- deps.GetLocator(),
- deps.GetGitCmdFactory(),
- deps.GetPackObjectsCache(),
- deps.GetPackObjectsLimiter(),
- ))
+ gitalypb.RegisterHookServiceServer(srv, hookservice.NewServer(deps))
gitalypb.RegisterRepositoryServiceServer(srv, repository.NewServer(deps))
})
}