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:
authorQuang-Minh Nguyen <qmnguyen@gitlab.com>2021-07-28 09:33:54 +0300
committerQuang-Minh Nguyen <qmnguyen@gitlab.com>2021-07-28 09:33:54 +0300
commita9540f961bde8fa51872532d4f9dda3e4b4bb0ac (patch)
tree304ad8390919b044727f933cac1a97d88b481ffb
parent818f3d85a2c8e6596376f1d2276aa22660203a6c (diff)
Generalize grpc.Server to grpc.ServiceRegistrar
-rw-r--r--cmd/gitaly-hooks/hooks_test.go2
-rw-r--r--internal/git/remoterepo/repository_test.go2
-rw-r--r--internal/git/updateref/update_with_hooks_test.go2
-rw-r--r--internal/gitaly/service/blob/testhelper_test.go2
-rw-r--r--internal/gitaly/service/cleanup/testhelper_test.go2
-rw-r--r--internal/gitaly/service/commit/testhelper_test.go2
-rw-r--r--internal/gitaly/service/conflicts/testhelper_test.go2
-rw-r--r--internal/gitaly/service/diff/testhelper_test.go2
-rw-r--r--internal/gitaly/service/hook/testhelper_test.go2
-rw-r--r--internal/gitaly/service/internalgitaly/testhelper_test.go2
-rw-r--r--internal/gitaly/service/namespace/testhelper_test.go2
-rw-r--r--internal/gitaly/service/objectpool/testhelper_test.go2
-rw-r--r--internal/gitaly/service/operations/branches_test.go4
-rw-r--r--internal/gitaly/service/operations/tags_test.go2
-rw-r--r--internal/gitaly/service/operations/testhelper_test.go2
-rw-r--r--internal/gitaly/service/ref/delete_refs_test.go2
-rw-r--r--internal/gitaly/service/ref/testhelper_test.go2
-rw-r--r--internal/gitaly/service/remote/fetch_internal_remote_test.go4
-rw-r--r--internal/gitaly/service/remote/testhelper_test.go2
-rw-r--r--internal/gitaly/service/remote/update_remote_mirror_test.go12
-rw-r--r--internal/gitaly/service/repository/apply_gitattributes_test.go2
-rw-r--r--internal/gitaly/service/repository/fetch_remote_test.go2
-rw-r--r--internal/gitaly/service/repository/fork_test.go5
-rw-r--r--internal/gitaly/service/repository/replicate_test.go2
-rw-r--r--internal/gitaly/service/repository/testhelper_test.go2
-rw-r--r--internal/gitaly/service/server/info_test.go2
-rw-r--r--internal/gitaly/service/smarthttp/receive_pack_test.go2
-rw-r--r--internal/gitaly/service/smarthttp/testhelper_test.go2
-rw-r--r--internal/gitaly/service/ssh/testhelper_test.go2
-rw-r--r--internal/gitaly/service/wiki/testhelper_test.go2
-rw-r--r--internal/gitaly/transaction/manager_test.go2
-rw-r--r--internal/praefect/coordinator_test.go2
-rw-r--r--internal/praefect/info_service_test.go2
-rw-r--r--internal/praefect/replicator_test.go2
-rw-r--r--internal/praefect/server_test.go2
-rw-r--r--internal/testhelper/testserver/gitaly.go23
36 files changed, 56 insertions, 54 deletions
diff --git a/cmd/gitaly-hooks/hooks_test.go b/cmd/gitaly-hooks/hooks_test.go
index 80e7dcdde..896217331 100644
--- a/cmd/gitaly-hooks/hooks_test.go
+++ b/cmd/gitaly-hooks/hooks_test.go
@@ -609,7 +609,7 @@ func (svc featureFlagAsserter) PackObjectsHook(stream gitalypb.HookService_PackO
}
func runHookServiceWithGitlabClient(t *testing.T, cfg config.Cfg, gitlabClient gitlab.Client) {
- testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterHookServiceServer(srv, featureFlagAsserter{
t: t, wrapped: hook.NewServer(deps.GetCfg(), deps.GetHookManager(), deps.GetGitCmdFactory()),
})
diff --git a/internal/git/remoterepo/repository_test.go b/internal/git/remoterepo/repository_test.go
index b74f88f75..aff19797d 100644
--- a/internal/git/remoterepo/repository_test.go
+++ b/internal/git/remoterepo/repository_test.go
@@ -22,7 +22,7 @@ import (
func TestRepository(t *testing.T) {
cfg := testcfg.Build(t)
- serverSocketPath := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ serverSocketPath := testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterRepositoryServiceServer(srv, repository.NewServer(
deps.GetCfg(),
deps.GetRubyServer(),
diff --git a/internal/git/updateref/update_with_hooks_test.go b/internal/git/updateref/update_with_hooks_test.go
index 3585ed5b0..972bf6881 100644
--- a/internal/git/updateref/update_with_hooks_test.go
+++ b/internal/git/updateref/update_with_hooks_test.go
@@ -100,7 +100,7 @@ func TestUpdaterWithHooks_UpdateReference(t *testing.T) {
// We need to set up a separate "real" hook service here, as it will be used in
// git-update-ref(1) spawned by `updateRefWithHooks()`
- testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterHookServiceServer(srv, hookservice.NewServer(deps.GetCfg(), deps.GetHookManager(), deps.GetGitCmdFactory()))
})
diff --git a/internal/gitaly/service/blob/testhelper_test.go b/internal/gitaly/service/blob/testhelper_test.go
index e7b64bd50..a0de32432 100644
--- a/internal/gitaly/service/blob/testhelper_test.go
+++ b/internal/gitaly/service/blob/testhelper_test.go
@@ -34,7 +34,7 @@ func setup(t *testing.T) (config.Cfg, *gitalypb.Repository, string, gitalypb.Blo
repo, repoPath, cleanup := gittest.CloneRepoAtStorage(t, cfg, cfg.Storages[0], t.Name())
t.Cleanup(cleanup)
- addr := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ addr := testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterBlobServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetLocator(),
diff --git a/internal/gitaly/service/cleanup/testhelper_test.go b/internal/gitaly/service/cleanup/testhelper_test.go
index d16a8bd4d..8dc286eff 100644
--- a/internal/gitaly/service/cleanup/testhelper_test.go
+++ b/internal/gitaly/service/cleanup/testhelper_test.go
@@ -37,7 +37,7 @@ func setupCleanupService(t *testing.T) (config.Cfg, *gitalypb.Repository, string
}
func runCleanupServiceServer(t *testing.T, cfg config.Cfg) string {
- return testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ return testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterCleanupServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetGitCmdFactory(),
diff --git a/internal/gitaly/service/commit/testhelper_test.go b/internal/gitaly/service/commit/testhelper_test.go
index 28eef0f78..a28fb70ff 100644
--- a/internal/gitaly/service/commit/testhelper_test.go
+++ b/internal/gitaly/service/commit/testhelper_test.go
@@ -66,7 +66,7 @@ func setupCommitServiceCreateRepo(
func startTestServices(t testing.TB, cfg config.Cfg) string {
t.Helper()
- return testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ return testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterCommitServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetLocator(),
diff --git a/internal/gitaly/service/conflicts/testhelper_test.go b/internal/gitaly/service/conflicts/testhelper_test.go
index c8f14d617..9b55622b2 100644
--- a/internal/gitaly/service/conflicts/testhelper_test.go
+++ b/internal/gitaly/service/conflicts/testhelper_test.go
@@ -84,7 +84,7 @@ func SetupConflictsService(t testing.TB, bare bool, hookManager hook.Manager) (c
}
func runConflictsServer(t testing.TB, cfg config.Cfg, hookManager hook.Manager) string {
- return testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ return testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterConflictsServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetHookManager(),
diff --git a/internal/gitaly/service/diff/testhelper_test.go b/internal/gitaly/service/diff/testhelper_test.go
index 1029cd3ed..c787d35fc 100644
--- a/internal/gitaly/service/diff/testhelper_test.go
+++ b/internal/gitaly/service/diff/testhelper_test.go
@@ -27,7 +27,7 @@ func testMain(m *testing.M) int {
func setupDiffService(t testing.TB, opt ...testserver.GitalyServerOpt) (config.Cfg, *gitalypb.Repository, string, gitalypb.DiffServiceClient) {
cfg, repo, repoPath := testcfg.BuildWithRepo(t)
- addr := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ addr := testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterDiffServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetLocator(),
diff --git a/internal/gitaly/service/hook/testhelper_test.go b/internal/gitaly/service/hook/testhelper_test.go
index dcbdd56e2..cd2630bfd 100644
--- a/internal/gitaly/service/hook/testhelper_test.go
+++ b/internal/gitaly/service/hook/testhelper_test.go
@@ -55,7 +55,7 @@ type serverOption func(*server)
func runHooksServer(t testing.TB, cfg config.Cfg, opts []serverOption, serverOpts ...testserver.GitalyServerOpt) string {
t.Helper()
- return testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ return testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
hookServer := NewServer(
deps.GetCfg(),
gitalyhook.NewManager(deps.GetLocator(), deps.GetTxManager(), deps.GetGitlabClient(), deps.GetCfg()),
diff --git a/internal/gitaly/service/internalgitaly/testhelper_test.go b/internal/gitaly/service/internalgitaly/testhelper_test.go
index d768d2d80..f092df931 100644
--- a/internal/gitaly/service/internalgitaly/testhelper_test.go
+++ b/internal/gitaly/service/internalgitaly/testhelper_test.go
@@ -25,7 +25,7 @@ func testMain(m *testing.M) int {
}
func setupInternalGitalyService(t *testing.T, cfg config.Cfg, internalService gitalypb.InternalGitalyServer) gitalypb.InternalGitalyClient {
- add := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ add := testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterInternalGitalyServer(srv, internalService)
}, testserver.WithDisablePraefect())
conn, err := grpc.Dial(add, grpc.WithInsecure())
diff --git a/internal/gitaly/service/namespace/testhelper_test.go b/internal/gitaly/service/namespace/testhelper_test.go
index a37b5a03a..a3851a41a 100644
--- a/internal/gitaly/service/namespace/testhelper_test.go
+++ b/internal/gitaly/service/namespace/testhelper_test.go
@@ -17,7 +17,7 @@ func setupNamespaceService(t testing.TB, opts ...testserver.GitalyServerOpt) (co
cfgBuilder := testcfg.NewGitalyCfgBuilder(testcfg.WithStorages("default", "other"))
cfg := cfgBuilder.Build(t)
- addr := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ addr := testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterNamespaceServiceServer(srv, NewServer(deps.GetLocator()))
}, opts...)
diff --git a/internal/gitaly/service/objectpool/testhelper_test.go b/internal/gitaly/service/objectpool/testhelper_test.go
index 7777a638c..f1b70c220 100644
--- a/internal/gitaly/service/objectpool/testhelper_test.go
+++ b/internal/gitaly/service/objectpool/testhelper_test.go
@@ -46,7 +46,7 @@ func setup(t *testing.T, opts ...testserver.GitalyServerOpt) (config.Cfg, *gital
}
func runObjectPoolServer(t *testing.T, cfg config.Cfg, locator storage.Locator, logger *logrus.Logger, opts ...testserver.GitalyServerOpt) string {
- return testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ return testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterObjectPoolServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetLocator(),
diff --git a/internal/gitaly/service/operations/branches_test.go b/internal/gitaly/service/operations/branches_test.go
index 3f082d517..ceea99842 100644
--- a/internal/gitaly/service/operations/branches_test.go
+++ b/internal/gitaly/service/operations/branches_test.go
@@ -122,7 +122,7 @@ func TestUserCreateBranchWithTransaction(t *testing.T) {
transactionServer := &testTransactionServer{}
cfg.ListenAddr = "127.0.0.1:0" // runs gitaly on the TCP address
- addr := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ addr := testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterOperationServiceServer(srv, NewServer(
deps.GetCfg(),
nil,
@@ -483,7 +483,7 @@ func TestUserDeleteBranch_transaction(t *testing.T) {
transactionServer := &testTransactionServer{}
- testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterOperationServiceServer(srv, NewServer(
deps.GetCfg(),
nil,
diff --git a/internal/gitaly/service/operations/tags_test.go b/internal/gitaly/service/operations/tags_test.go
index c709da02c..f2f5eaa34 100644
--- a/internal/gitaly/service/operations/tags_test.go
+++ b/internal/gitaly/service/operations/tags_test.go
@@ -279,7 +279,7 @@ func TestUserCreateTagWithTransaction(t *testing.T) {
// runOperationServiceServer as it puts a Praefect server in between if
// running Praefect tests, which would break our test setup.
transactionServer := &testTransactionServer{}
- testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterOperationServiceServer(srv, NewServer(
deps.GetCfg(),
nil,
diff --git a/internal/gitaly/service/operations/testhelper_test.go b/internal/gitaly/service/operations/testhelper_test.go
index 0582b12d7..59506a931 100644
--- a/internal/gitaly/service/operations/testhelper_test.go
+++ b/internal/gitaly/service/operations/testhelper_test.go
@@ -110,7 +110,7 @@ func setupOperationsServiceWithRuby(
func runOperationServiceServer(t testing.TB, cfg config.Cfg, rubySrv *rubyserver.Server, options ...testserver.GitalyServerOpt) string {
t.Helper()
- return testserver.RunGitalyServer(t, cfg, rubySrv, func(srv *grpc.Server, deps *service.Dependencies) {
+ return testserver.RunGitalyServer(t, cfg, rubySrv, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterOperationServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetRubyServer(),
diff --git a/internal/gitaly/service/ref/delete_refs_test.go b/internal/gitaly/service/ref/delete_refs_test.go
index ba28bf018..677e81d3e 100644
--- a/internal/gitaly/service/ref/delete_refs_test.go
+++ b/internal/gitaly/service/ref/delete_refs_test.go
@@ -91,7 +91,7 @@ func TestDeleteRefs_transaction(t *testing.T) {
},
}
- addr := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ addr := testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterRefServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetLocator(),
diff --git a/internal/gitaly/service/ref/testhelper_test.go b/internal/gitaly/service/ref/testhelper_test.go
index 55683f095..eda08dc8b 100644
--- a/internal/gitaly/service/ref/testhelper_test.go
+++ b/internal/gitaly/service/ref/testhelper_test.go
@@ -70,7 +70,7 @@ func setupRefServiceWithoutRepo(t testing.TB) (config.Cfg, gitalypb.RefServiceCl
}
func runRefServiceServer(t testing.TB, cfg config.Cfg) string {
- return testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ return testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterRefServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetLocator(),
diff --git a/internal/gitaly/service/remote/fetch_internal_remote_test.go b/internal/gitaly/service/remote/fetch_internal_remote_test.go
index 35ec8e25c..f142b6dec 100644
--- a/internal/gitaly/service/remote/fetch_internal_remote_test.go
+++ b/internal/gitaly/service/remote/fetch_internal_remote_test.go
@@ -150,7 +150,7 @@ func TestSuccessfulFetchInternalRemote(t *testing.T) {
testhelper.ConfigureGitalyHooksBin(t, remoteCfg)
- remoteAddr := testserver.RunGitalyServer(t, remoteCfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ remoteAddr := testserver.RunGitalyServer(t, remoteCfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterSSHServiceServer(srv, ssh.NewServer(
deps.GetCfg(),
deps.GetLocator(),
@@ -180,7 +180,7 @@ func TestSuccessfulFetchInternalRemote(t *testing.T) {
getGitalySSHInvocationParams := listenGitalySSHCalls(t, localCfg)
hookManager := &mockHookManager{}
- localAddr := testserver.RunGitalyServer(t, localCfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ localAddr := testserver.RunGitalyServer(t, localCfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterRemoteServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetRubyServer(),
diff --git a/internal/gitaly/service/remote/testhelper_test.go b/internal/gitaly/service/remote/testhelper_test.go
index dac64c19a..f200e13a6 100644
--- a/internal/gitaly/service/remote/testhelper_test.go
+++ b/internal/gitaly/service/remote/testhelper_test.go
@@ -57,7 +57,7 @@ func setupRemoteServiceWithRuby(t *testing.T, cfg config.Cfg, rubySrv *rubyserve
repo, repoPath, cleanup := gittest.CloneRepoAtStorage(t, cfg, cfg.Storages[0], t.Name())
t.Cleanup(cleanup)
- addr := testserver.RunGitalyServer(t, cfg, rubySrv, func(srv *grpc.Server, deps *service.Dependencies) {
+ addr := testserver.RunGitalyServer(t, cfg, rubySrv, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterRemoteServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetRubyServer(),
diff --git a/internal/gitaly/service/remote/update_remote_mirror_test.go b/internal/gitaly/service/remote/update_remote_mirror_test.go
index 85b9a46ce..7ca63df0d 100644
--- a/internal/gitaly/service/remote/update_remote_mirror_test.go
+++ b/internal/gitaly/service/remote/update_remote_mirror_test.go
@@ -503,7 +503,7 @@ func TestUpdateRemoteMirror(t *testing.T) {
}
}
- addr := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ addr := testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
cmdFactory := deps.GetGitCmdFactory()
if tc.wrapCommandFactory != nil {
cmdFactory = tc.wrapCommandFactory(t, deps.GetGitCmdFactory())
@@ -575,7 +575,7 @@ func TestSuccessfulUpdateRemoteMirrorRequest(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- serverSocketPath := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ serverSocketPath := testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterRemoteServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetRubyServer(),
@@ -681,7 +681,7 @@ func TestSuccessfulUpdateRemoteMirrorRequestWithWildcards(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- serverSocketPath := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ serverSocketPath := testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterRemoteServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetRubyServer(),
@@ -768,7 +768,7 @@ func TestUpdateRemoteMirrorInmemory(t *testing.T) {
cfg := testcfg.Build(t)
- serverSocketPath := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ serverSocketPath := testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterRemoteServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetRubyServer(),
@@ -819,7 +819,7 @@ func TestSuccessfulUpdateRemoteMirrorRequestWithKeepDivergentRefs(t *testing.T)
ctx, cancel := testhelper.Context()
defer cancel()
- serverSocketPath := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ serverSocketPath := testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterRemoteServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetRubyServer(),
@@ -911,7 +911,7 @@ func TestFailedUpdateRemoteMirrorRequestDueToValidation(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- serverSocketPath := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ serverSocketPath := testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterRemoteServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetRubyServer(),
diff --git a/internal/gitaly/service/repository/apply_gitattributes_test.go b/internal/gitaly/service/repository/apply_gitattributes_test.go
index a19ee3c2b..a3c093a9a 100644
--- a/internal/gitaly/service/repository/apply_gitattributes_test.go
+++ b/internal/gitaly/service/repository/apply_gitattributes_test.go
@@ -90,7 +90,7 @@ func TestApplyGitattributesWithTransaction(t *testing.T) {
cfg, repo, repoPath := testcfg.BuildWithRepo(t)
transactionServer := &testTransactionServer{}
- testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterRepositoryServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetRubyServer(),
diff --git a/internal/gitaly/service/repository/fetch_remote_test.go b/internal/gitaly/service/repository/fetch_remote_test.go
index 8dc675127..34f3b8475 100644
--- a/internal/gitaly/service/repository/fetch_remote_test.go
+++ b/internal/gitaly/service/repository/fetch_remote_test.go
@@ -221,7 +221,7 @@ func TestFetchRemote_transaction(t *testing.T) {
sourceCfg, _, sourceRepoPath := testcfg.BuildWithRepo(t)
txManager := &mockTxManager{}
- addr := testserver.RunGitalyServer(t, sourceCfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ addr := testserver.RunGitalyServer(t, sourceCfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterRepositoryServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetRubyServer(),
diff --git a/internal/gitaly/service/repository/fork_test.go b/internal/gitaly/service/repository/fork_test.go
index 8a387c661..76542080a 100644
--- a/internal/gitaly/service/repository/fork_test.go
+++ b/internal/gitaly/service/repository/fork_test.go
@@ -28,6 +28,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/ssh"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/transaction"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitlab"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/streamrpc"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testcfg"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testserver"
@@ -217,7 +218,7 @@ func runSecureServer(t *testing.T, cfg config.Cfg, rubySrv *rubyserver.Server) s
registry := backchannel.NewRegistry()
locator := config.NewLocator(cfg)
cache := cache.New(cfg, locator)
- server, err := gserver.New(true, cfg, testhelper.DiscardTestEntry(t), registry, cache)
+ server, err := gserver.New(true, cfg, testhelper.DiscardTestEntry(t), registry, cache, streamrpc.NewServer())
require.NoError(t, err)
listener, addr := testhelper.GetLocalhostListener(t)
@@ -239,7 +240,7 @@ func runSecureServer(t *testing.T, cfg config.Cfg, rubySrv *rubyserver.Server) s
// protected by the same TLS certificate.
cfg.TLS.KeyPath = ""
- testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterHookServiceServer(srv, hookservice.NewServer(deps.GetCfg(), deps.GetHookManager(), deps.GetGitCmdFactory()))
})
diff --git a/internal/gitaly/service/repository/replicate_test.go b/internal/gitaly/service/repository/replicate_test.go
index a89228393..a29096e3c 100644
--- a/internal/gitaly/service/repository/replicate_test.go
+++ b/internal/gitaly/service/repository/replicate_test.go
@@ -392,7 +392,7 @@ func TestReplicateRepository_FailedFetchInternalRemote(t *testing.T) {
}
func runServerWithBadFetchInternalRemote(t *testing.T, cfg config.Cfg) string {
- return testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ return testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterRepositoryServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetRubyServer(),
diff --git a/internal/gitaly/service/repository/testhelper_test.go b/internal/gitaly/service/repository/testhelper_test.go
index 62be9ecc4..4f85f87ce 100644
--- a/internal/gitaly/service/repository/testhelper_test.go
+++ b/internal/gitaly/service/repository/testhelper_test.go
@@ -119,7 +119,7 @@ func assertModTimeAfter(t *testing.T, afterTime time.Time, paths ...string) bool
}
func runRepositoryServerWithConfig(t testing.TB, cfg config.Cfg, rubySrv *rubyserver.Server, opts ...testserver.GitalyServerOpt) string {
- return testserver.RunGitalyServer(t, cfg, rubySrv, func(srv *grpc.Server, deps *service.Dependencies) {
+ return testserver.RunGitalyServer(t, cfg, rubySrv, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterRepositoryServiceServer(srv, NewServer(
cfg,
deps.GetRubyServer(),
diff --git a/internal/gitaly/service/server/info_test.go b/internal/gitaly/service/server/info_test.go
index e253264cd..fa2102d34 100644
--- a/internal/gitaly/service/server/info_test.go
+++ b/internal/gitaly/service/server/info_test.go
@@ -57,7 +57,7 @@ func TestGitalyServerInfo(t *testing.T) {
}
func runServer(t *testing.T, cfg config.Cfg, opts ...testserver.GitalyServerOpt) string {
- return testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ return testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterServerServiceServer(srv, NewServer(deps.GetGitCmdFactory(), deps.GetCfg().Storages))
}, opts...)
}
diff --git a/internal/gitaly/service/smarthttp/receive_pack_test.go b/internal/gitaly/service/smarthttp/receive_pack_test.go
index 818ad582f..4a294235b 100644
--- a/internal/gitaly/service/smarthttp/receive_pack_test.go
+++ b/internal/gitaly/service/smarthttp/receive_pack_test.go
@@ -622,7 +622,7 @@ func TestPostReceiveWithReferenceTransactionHook(t *testing.T) {
refTransactionServer := &testTransactionServer{}
- addr := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ addr := testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterSmartHTTPServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetLocator(),
diff --git a/internal/gitaly/service/smarthttp/testhelper_test.go b/internal/gitaly/service/smarthttp/testhelper_test.go
index b26397985..2ee3d2ddc 100644
--- a/internal/gitaly/service/smarthttp/testhelper_test.go
+++ b/internal/gitaly/service/smarthttp/testhelper_test.go
@@ -36,7 +36,7 @@ func testMain(m *testing.M) int {
}
func startSmartHTTPServer(t *testing.T, cfg config.Cfg, serverOpts ...ServerOpt) testserver.GitalyServer {
- return testserver.StartGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ return testserver.StartGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterSmartHTTPServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetLocator(),
diff --git a/internal/gitaly/service/ssh/testhelper_test.go b/internal/gitaly/service/ssh/testhelper_test.go
index d99c6b2ab..2695c7650 100644
--- a/internal/gitaly/service/ssh/testhelper_test.go
+++ b/internal/gitaly/service/ssh/testhelper_test.go
@@ -31,7 +31,7 @@ func runSSHServer(t *testing.T, cfg config.Cfg, serverOpts ...testserver.GitalyS
}
func runSSHServerWithOptions(t *testing.T, cfg config.Cfg, opts []ServerOpt, serverOpts ...testserver.GitalyServerOpt) string {
- return testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ return testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterSSHServiceServer(srv, NewServer(
deps.GetCfg(),
deps.GetLocator(),
diff --git a/internal/gitaly/service/wiki/testhelper_test.go b/internal/gitaly/service/wiki/testhelper_test.go
index 85d2d1cc4..61ccfd3d1 100644
--- a/internal/gitaly/service/wiki/testhelper_test.go
+++ b/internal/gitaly/service/wiki/testhelper_test.go
@@ -85,7 +85,7 @@ func TestWithRubySidecar(t *testing.T) {
}
func setupWikiService(t testing.TB, cfg config.Cfg, rubySrv *rubyserver.Server) gitalypb.WikiServiceClient {
- addr := testserver.RunGitalyServer(t, cfg, rubySrv, func(srv *grpc.Server, deps *service.Dependencies) {
+ addr := testserver.RunGitalyServer(t, cfg, rubySrv, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterWikiServiceServer(srv, NewServer(deps.GetRubyServer(), deps.GetLocator()))
})
client := newWikiClient(t, addr)
diff --git a/internal/gitaly/transaction/manager_test.go b/internal/gitaly/transaction/manager_test.go
index 028df3d20..6878a0708 100644
--- a/internal/gitaly/transaction/manager_test.go
+++ b/internal/gitaly/transaction/manager_test.go
@@ -191,7 +191,7 @@ func TestPoolManager_Stop(t *testing.T) {
func runTransactionServer(t *testing.T, cfg config.Cfg) (*testTransactionServer, string) {
transactionServer := &testTransactionServer{}
cfg.ListenAddr = ":0" // pushes gRPC to listen on the TCP address
- addr := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ addr := testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterRefTransactionServer(srv, transactionServer)
}, testserver.WithDisablePraefect())
return transactionServer, addr
diff --git a/internal/praefect/coordinator_test.go b/internal/praefect/coordinator_test.go
index 811f40c87..8d0814afe 100644
--- a/internal/praefect/coordinator_test.go
+++ b/internal/praefect/coordinator_test.go
@@ -1451,7 +1451,7 @@ func TestCoordinator_grpcErrorHandling(t *testing.T) {
wg: &wg,
}
- addr := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ addr := testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterOperationServiceServer(srv, operationServer)
}, testserver.WithDiskCache(&mockDiskCache{}))
diff --git a/internal/praefect/info_service_test.go b/internal/praefect/info_service_test.go
index 4fd1a69fb..8e00abd6f 100644
--- a/internal/praefect/info_service_test.go
+++ b/internal/praefect/info_service_test.go
@@ -31,7 +31,7 @@ func TestInfoService_RepositoryReplicas(t *testing.T) {
testRepo = repo
}
cfgs = append(cfgs, cfg)
- cfgs[i].SocketPath = testserver.RunGitalyServer(t, cfgs[i], nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ cfgs[i].SocketPath = testserver.RunGitalyServer(t, cfgs[i], nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterRepositoryServiceServer(srv, repository.NewServer(
deps.GetCfg(),
deps.GetRubyServer(),
diff --git a/internal/praefect/replicator_test.go b/internal/praefect/replicator_test.go
index b5675f802..a4fc45e85 100644
--- a/internal/praefect/replicator_test.go
+++ b/internal/praefect/replicator_test.go
@@ -570,7 +570,7 @@ func (m *mockServer) PackRefs(ctx context.Context, in *gitalypb.PackRefsRequest)
func runMockRepositoryServer(t *testing.T, cfg gconfig.Cfg) (*mockServer, string) {
mockServer := newMockRepositoryServer()
- addr := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ addr := testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterRepositoryServiceServer(srv, mockServer)
gitalypb.RegisterRefServiceServer(srv, mockServer)
})
diff --git a/internal/praefect/server_test.go b/internal/praefect/server_test.go
index 71812100e..22da58a6b 100644
--- a/internal/praefect/server_test.go
+++ b/internal/praefect/server_test.go
@@ -724,7 +724,7 @@ func (m *mockSmartHTTP) Called(method string) int {
}
func newSmartHTTPGrpcServer(t *testing.T, cfg gconfig.Cfg, smartHTTPService gitalypb.SmartHTTPServiceServer) string {
- return testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) {
+ return testserver.RunGitalyServer(t, cfg, nil, func(srv grpc.ServiceRegistrar, deps *service.Dependencies) {
gitalypb.RegisterSmartHTTPServiceServer(srv, smartHTTPService)
}, testserver.WithDisablePraefect())
}
diff --git a/internal/testhelper/testserver/gitaly.go b/internal/testhelper/testserver/gitaly.go
index df54fa39c..399aed537 100644
--- a/internal/testhelper/testserver/gitaly.go
+++ b/internal/testhelper/testserver/gitaly.go
@@ -41,7 +41,7 @@ import (
// It accepts addition Registrar to register all required service instead of
// calling service.RegisterAll explicitly because it creates a circular dependency
// when the function is used in on of internal/gitaly/service/... packages.
-func RunGitalyServer(t testing.TB, cfg config.Cfg, rubyServer *rubyserver.Server, registrar func(srv *grpc.Server, deps *service.Dependencies), opts ...GitalyServerOpt) string {
+func RunGitalyServer(t testing.TB, cfg config.Cfg, rubyServer *rubyserver.Server, registrar func(srv grpc.ServiceRegistrar, deps *service.Dependencies), opts ...GitalyServerOpt) string {
_, gitalyAddr, disablePraefect := runGitaly(t, cfg, rubyServer, registrar, opts...)
praefectBinPath, ok := os.LookupEnv("GITALY_TEST_PRAEFECT_BIN")
@@ -135,7 +135,7 @@ func (gs GitalyServer) Address() string {
}
// StartGitalyServer creates and runs gitaly (and praefect as a proxy) server.
-func StartGitalyServer(t testing.TB, cfg config.Cfg, rubyServer *rubyserver.Server, registrar func(srv *grpc.Server, deps *service.Dependencies), opts ...GitalyServerOpt) GitalyServer {
+func StartGitalyServer(t testing.TB, cfg config.Cfg, rubyServer *rubyserver.Server, registrar func(srv grpc.ServiceRegistrar, deps *service.Dependencies), opts ...GitalyServerOpt) GitalyServer {
gitalySrv, gitalyAddr, disablePraefect := runGitaly(t, cfg, rubyServer, registrar, opts...)
praefectBinPath, ok := os.LookupEnv("GITALY_TEST_PRAEFECT_BIN")
@@ -199,7 +199,7 @@ func IsHealthy(conn *grpc.ClientConn, timeout time.Duration) bool {
return true
}
-func runGitaly(t testing.TB, cfg config.Cfg, rubyServer *rubyserver.Server, registrar func(srv *grpc.Server, deps *service.Dependencies), opts ...GitalyServerOpt) (*grpc.Server, string, bool) {
+func runGitaly(t testing.TB, cfg config.Cfg, rubyServer *rubyserver.Server, registrar func(srv grpc.ServiceRegistrar, deps *service.Dependencies), opts ...GitalyServerOpt) (*grpc.Server, string, bool) {
t.Helper()
var gsd gitalyServerDeps
@@ -210,20 +210,21 @@ func runGitaly(t testing.TB, cfg config.Cfg, rubyServer *rubyserver.Server, regi
deps := gsd.createDependencies(t, cfg, rubyServer)
t.Cleanup(func() { gsd.conns.Close() })
- srv, err := server.NewGitalyServerFactory(
+ grpcSrv, srpcSrv, err := server.NewGitalyServerFactory(
cfg,
gsd.logger.WithField("test", t.Name()),
deps.GetBackchannelRegistry(),
deps.GetDiskCache(),
).CreateExternal(cfg.TLS.CertPath != "" && cfg.TLS.KeyPath != "")
require.NoError(t, err)
- t.Cleanup(srv.Stop)
+ t.Cleanup(grpcSrv.Stop)
- registrar(srv, deps)
- if _, found := srv.GetServiceInfo()["grpc.health.v1.Health"]; !found {
+ registrar(grpcSrv, deps)
+ registrar(srpcSrv, deps)
+ if _, found := grpcSrv.GetServiceInfo()["grpc.health.v1.Health"]; !found {
// we should register health service as it is used for the health checks
// praefect service executes periodically (and on the bootstrap step)
- healthpb.RegisterHealthServer(srv, health.NewServer())
+ healthpb.RegisterHealthServer(grpcSrv, health.NewServer())
}
// listen on internal socket
@@ -243,7 +244,7 @@ func runGitaly(t testing.TB, cfg config.Cfg, rubyServer *rubyserver.Server, regi
internalListener, err := net.Listen("unix", cfg.GitalyInternalSocketPath())
require.NoError(t, err)
- go srv.Serve(internalListener)
+ go grpcSrv.Serve(internalListener)
}
var listener net.Listener
@@ -266,9 +267,9 @@ func runGitaly(t testing.TB, cfg config.Cfg, rubyServer *rubyserver.Server, regi
addr = "unix://" + serverSocketPath
}
- go srv.Serve(listener)
+ go grpcSrv.Serve(listener)
- return srv, addr, gsd.disablePraefect
+ return grpcSrv, addr, gsd.disablePraefect
}
type gitalyServerDeps struct {