diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-09-18 11:36:35 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-09-19 09:47:33 +0300 |
commit | 85eacc1b958c8c8ef4dff18d661415931205c6c0 (patch) | |
tree | c4beeb8e809bcf889c6103914d95ed2a302f254a /internal/praefect | |
parent | 928f1c937afb39eb7ae3c2dfad7e9fdd41e0d25c (diff) |
service: Simplify injection of dependencies for Repository 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/praefect')
-rw-r--r-- | internal/praefect/info_service_test.go | 13 | ||||
-rw-r--r-- | internal/praefect/verifier_test.go | 15 |
2 files changed, 4 insertions, 24 deletions
diff --git a/internal/praefect/info_service_test.go b/internal/praefect/info_service_test.go index 72cd6ce27..f2d37af59 100644 --- a/internal/praefect/info_service_test.go +++ b/internal/praefect/info_service_test.go @@ -36,18 +36,7 @@ func TestInfoService_RepositoryReplicas(t *testing.T) { cfg := testcfg.Build(t, testcfg.WithStorages(storage)) cfgs = append(cfgs, cfg) cfgs[i].SocketPath = testserver.RunGitalyServer(t, cfgs[i], func(srv *grpc.Server, deps *service.Dependencies) { - gitalypb.RegisterRepositoryServiceServer(srv, repository.NewServer( - deps.GetCfg(), - deps.GetLocator(), - deps.GetTxManager(), - deps.GetGitCmdFactory(), - deps.GetCatfileCache(), - deps.GetConnsPool(), - deps.GetHousekeepingManager(), - deps.GetBackupSink(), - deps.GetBackupLocator(), - deps.GetRepositoryCounter(), - )) + gitalypb.RegisterRepositoryServiceServer(srv, repository.NewServer(deps)) }, testserver.WithDisablePraefect()) cfgNodes = append(cfgNodes, &config.Node{ Storage: cfgs[i].Storages[0].Name, diff --git a/internal/praefect/verifier_test.go b/internal/praefect/verifier_test.go index d3945a9b6..bea23c51f 100644 --- a/internal/praefect/verifier_test.go +++ b/internal/praefect/verifier_test.go @@ -475,18 +475,9 @@ func TestVerifier(t *testing.T) { registerFunc := setup.RegisterAll if tc.erroringGitalys[storageName] { registerFunc = func(srv *grpc.Server, deps *service.Dependencies) { - gitalypb.RegisterRepositoryServiceServer(srv, erroringRepositoryService{repository.NewServer( - deps.GetCfg(), - deps.GetLocator(), - deps.GetTxManager(), - deps.GetGitCmdFactory(), - deps.GetCatfileCache(), - deps.GetConnsPool(), - deps.GetHousekeepingManager(), - deps.GetBackupSink(), - deps.GetBackupLocator(), - deps.GetRepositoryCounter(), - )}) + gitalypb.RegisterRepositoryServiceServer(srv, erroringRepositoryService{ + repository.NewServer(deps), + }) } } |