diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-04-03 09:09:52 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-04-03 11:23:35 +0300 |
commit | c9a98b8ca1834d6a43de2be8be87eb3ec4264778 (patch) | |
tree | b2246563e283460736c24ee0e7102db62f25115c | |
parent | b9173264367e7de1f6e3d5482589c0022b091335 (diff) |
gitaly: Remove Ruby server dependency
The Ruby server is never set up anymore and we don't ever use it either.
Let's remove the dependency on it.
48 files changed, 82 insertions, 91 deletions
diff --git a/cmd/gitaly-backup/create_test.go b/cmd/gitaly-backup/create_test.go index dd178a540..6e9bbeaf7 100644 --- a/cmd/gitaly-backup/create_test.go +++ b/cmd/gitaly-backup/create_test.go @@ -23,7 +23,7 @@ import ( func TestCreateSubcommand(t *testing.T) { cfg := testcfg.Build(t) - cfg.SocketPath = testserver.RunGitalyServer(t, cfg, nil, setup.RegisterAll) + cfg.SocketPath = testserver.RunGitalyServer(t, cfg, setup.RegisterAll) ctx := testhelper.Context(t) path := testhelper.TempDir(t) diff --git a/cmd/gitaly-backup/restore_test.go b/cmd/gitaly-backup/restore_test.go index 40e348022..607f413c6 100644 --- a/cmd/gitaly-backup/restore_test.go +++ b/cmd/gitaly-backup/restore_test.go @@ -27,7 +27,7 @@ func TestRestoreSubcommand(t *testing.T) { cfg := testcfg.Build(t) testcfg.BuildGitalyHooks(t, cfg) - cfg.SocketPath = testserver.RunGitalyServer(t, cfg, nil, setup.RegisterAll) + cfg.SocketPath = testserver.RunGitalyServer(t, cfg, setup.RegisterAll) existingRepo, existRepoPath := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{ Seed: gittest.SeedGitLabTest, diff --git a/cmd/gitaly-hooks/hooks_test.go b/cmd/gitaly-hooks/hooks_test.go index 1bc887a90..b200793e2 100644 --- a/cmd/gitaly-hooks/hooks_test.go +++ b/cmd/gitaly-hooks/hooks_test.go @@ -578,7 +578,7 @@ func (svc baggageAsserter) PackObjectsHookWithSidechannel(ctx context.Context, r } func runHookServiceWithGitlabClient(t *testing.T, cfg config.Cfg, assertUserDetails bool, gitlabClient gitlab.Client, serverOpts ...testserver.GitalyServerOpt) { - testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + testserver.RunGitalyServer(t, cfg, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterHookServiceServer(srv, baggageAsserter{ t: t, assertUserDetails: assertUserDetails, diff --git a/cmd/gitaly-ssh/auth_test.go b/cmd/gitaly-ssh/auth_test.go index 0446d3875..e8ac5c5ab 100644 --- a/cmd/gitaly-ssh/auth_test.go +++ b/cmd/gitaly-ssh/auth_test.go @@ -45,7 +45,7 @@ func TestConnectivity(t *testing.T) { runGitaly := func(tb testing.TB, cfg config.Cfg) string { tb.Helper() - return testserver.RunGitalyServer(tb, cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + return testserver.RunGitalyServer(tb, cfg, setup.RegisterAll, testserver.WithDisablePraefect()) } testCases := []struct { diff --git a/cmd/gitaly-ssh/upload_pack_test.go b/cmd/gitaly-ssh/upload_pack_test.go index 06a30dcec..9b861fabc 100644 --- a/cmd/gitaly-ssh/upload_pack_test.go +++ b/cmd/gitaly-ssh/upload_pack_test.go @@ -32,7 +32,7 @@ func TestVisibilityOfHiddenRefs(t *testing.T) { SkipCreationViaService: true, }) - address := testserver.RunGitalyServer(t, cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + address := testserver.RunGitalyServer(t, cfg, setup.RegisterAll, testserver.WithDisablePraefect()) // Create a keep-around ref commitID := gittest.WriteCommit(t, cfg, repoPath) diff --git a/cmd/praefect/subcmd_list_untracked_repositories_test.go b/cmd/praefect/subcmd_list_untracked_repositories_test.go index 690df12d6..a40787e2f 100644 --- a/cmd/praefect/subcmd_list_untracked_repositories_test.go +++ b/cmd/praefect/subcmd_list_untracked_repositories_test.go @@ -55,8 +55,8 @@ func TestListUntrackedRepositories_Exec(t *testing.T) { g1Cfg := testcfg.Build(t, testcfg.WithStorages("gitaly-1")) g2Cfg := testcfg.Build(t, testcfg.WithStorages("gitaly-2")) - g1Addr := testserver.RunGitalyServer(t, g1Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) - g2Addr := testserver.RunGitalyServer(t, g2Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + g1Addr := testserver.RunGitalyServer(t, g1Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) + g2Addr := testserver.RunGitalyServer(t, g2Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) db := testdb.New(t) var database string diff --git a/cmd/praefect/subcmd_remove_repository_test.go b/cmd/praefect/subcmd_remove_repository_test.go index 7878a965d..c31fd2215 100644 --- a/cmd/praefect/subcmd_remove_repository_test.go +++ b/cmd/praefect/subcmd_remove_repository_test.go @@ -76,8 +76,8 @@ func TestRemoveRepository_Exec(t *testing.T) { g1Cfg := testcfg.Build(t, testcfg.WithStorages("gitaly-1")) g2Cfg := testcfg.Build(t, testcfg.WithStorages("gitaly-2")) - g1Addr := testserver.RunGitalyServer(t, g1Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) - g2Srv := testserver.StartGitalyServer(t, g2Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + g1Addr := testserver.RunGitalyServer(t, g1Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) + g2Srv := testserver.StartGitalyServer(t, g2Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) db := testdb.New(t) diff --git a/cmd/praefect/subcmd_track_repositories_test.go b/cmd/praefect/subcmd_track_repositories_test.go index b683f0f87..498752d79 100644 --- a/cmd/praefect/subcmd_track_repositories_test.go +++ b/cmd/praefect/subcmd_track_repositories_test.go @@ -42,8 +42,8 @@ func TestAddRepositories_Exec_invalidInput(t *testing.T) { g1Cfg := testcfg.Build(t, testcfg.WithStorages("gitaly-1")) g2Cfg := testcfg.Build(t, testcfg.WithStorages("gitaly-2")) - g1Srv := testserver.StartGitalyServer(t, g1Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) - g2Srv := testserver.StartGitalyServer(t, g2Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + g1Srv := testserver.StartGitalyServer(t, g1Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) + g2Srv := testserver.StartGitalyServer(t, g2Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) defer g2Srv.Shutdown() defer g1Srv.Shutdown() g1Addr := g1Srv.Address() @@ -202,8 +202,8 @@ func TestAddRepositories_Exec(t *testing.T) { testcfg.BuildGitalyHooks(t, g2Cfg) testcfg.BuildGitalySSH(t, g2Cfg) - g1Srv := testserver.StartGitalyServer(t, g1Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) - g2Srv := testserver.StartGitalyServer(t, g2Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + g1Srv := testserver.StartGitalyServer(t, g1Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) + g2Srv := testserver.StartGitalyServer(t, g2Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) defer g2Srv.Shutdown() defer g1Srv.Shutdown() diff --git a/cmd/praefect/subcmd_track_repository_test.go b/cmd/praefect/subcmd_track_repository_test.go index ec3131147..da473efd7 100644 --- a/cmd/praefect/subcmd_track_repository_test.go +++ b/cmd/praefect/subcmd_track_repository_test.go @@ -79,8 +79,8 @@ func TestAddRepository_Exec(t *testing.T) { testcfg.BuildGitalyHooks(t, g2Cfg) testcfg.BuildGitalySSH(t, g2Cfg) - g1Srv := testserver.StartGitalyServer(t, g1Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) - g2Srv := testserver.StartGitalyServer(t, g2Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + g1Srv := testserver.StartGitalyServer(t, g1Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) + g2Srv := testserver.StartGitalyServer(t, g2Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) defer g2Srv.Shutdown() defer g1Srv.Shutdown() diff --git a/internal/backup/backup_test.go b/internal/backup/backup_test.go index 6f6ddeeb0..aee48ca64 100644 --- a/internal/backup/backup_test.go +++ b/internal/backup/backup_test.go @@ -32,7 +32,7 @@ func TestManager_RemoveAllRepositories(t *testing.T) { const backupID = "abc123" cfg := testcfg.Build(t) - cfg.SocketPath = testserver.RunGitalyServer(t, cfg, nil, setup.RegisterAll) + cfg.SocketPath = testserver.RunGitalyServer(t, cfg, setup.RegisterAll) ctx := testhelper.Context(t) @@ -63,7 +63,7 @@ func TestManager_Create(t *testing.T) { cfg := testcfg.Build(t) - cfg.SocketPath = testserver.RunGitalyServer(t, cfg, nil, setup.RegisterAll) + cfg.SocketPath = testserver.RunGitalyServer(t, cfg, setup.RegisterAll) ctx := testhelper.Context(t) @@ -185,7 +185,7 @@ func TestManager_Create_incremental(t *testing.T) { cfg := testcfg.Build(t) - cfg.SocketPath = testserver.RunGitalyServer(t, cfg, nil, setup.RegisterAll) + cfg.SocketPath = testserver.RunGitalyServer(t, cfg, setup.RegisterAll) ctx := testhelper.Context(t) for _, tc := range []struct { @@ -301,7 +301,7 @@ func TestManager_Restore(t *testing.T) { cfg := testcfg.Build(t) testcfg.BuildGitalyHooks(t, cfg) - cfg.SocketPath = testserver.RunGitalyServer(t, cfg, nil, setup.RegisterAll) + cfg.SocketPath = testserver.RunGitalyServer(t, cfg, setup.RegisterAll) cc, err := client.Dial(cfg.SocketPath, nil) require.NoError(t, err) @@ -535,7 +535,7 @@ func TestManager_CreateRestore_contextServerInfo(t *testing.T) { cfg := testcfg.Build(t) testcfg.BuildGitalyHooks(t, cfg) - cfg.SocketPath = testserver.RunGitalyServer(t, cfg, nil, setup.RegisterAll) + cfg.SocketPath = testserver.RunGitalyServer(t, cfg, setup.RegisterAll) ctx := testhelper.Context(t) diff --git a/internal/cli/gitaly/hooks_test.go b/internal/cli/gitaly/hooks_test.go index 1aedcd940..4121d8e9e 100644 --- a/internal/cli/gitaly/hooks_test.go +++ b/internal/cli/gitaly/hooks_test.go @@ -33,7 +33,7 @@ func TestSetHooksSubcommand(t *testing.T) { cfg := testcfg.Build(t) testcfg.BuildGitaly(t, cfg) - serverSocketPath := testserver.RunGitalyServer(t, cfg, nil, setup.RegisterAll) + serverSocketPath := testserver.RunGitalyServer(t, cfg, setup.RegisterAll) repoCfg := cfg repoCfg.SocketPath = serverSocketPath diff --git a/internal/git/housekeeping/optimize_repository_ext_test.go b/internal/git/housekeeping/optimize_repository_ext_test.go index d81843bd0..23168b359 100644 --- a/internal/git/housekeeping/optimize_repository_ext_test.go +++ b/internal/git/housekeeping/optimize_repository_ext_test.go @@ -33,7 +33,7 @@ func TestPruneIfNeeded(t *testing.T) { ctx := testhelper.Context(t) cfg := testcfg.Build(t) - cfg.SocketPath = testserver.RunGitalyServer(t, cfg, nil, setup.RegisterAll) + cfg.SocketPath = testserver.RunGitalyServer(t, cfg, setup.RegisterAll) for _, tc := range []struct { desc string diff --git a/internal/git/localrepo/remote_extra_test.go b/internal/git/localrepo/remote_extra_test.go index dfb70ec24..666734660 100644 --- a/internal/git/localrepo/remote_extra_test.go +++ b/internal/git/localrepo/remote_extra_test.go @@ -27,7 +27,7 @@ func TestRepo_FetchInternal(t *testing.T) { cfg := testcfg.Build(t) protocolDetectingFactory := gittest.NewProtocolDetectingCommandFactory(t, ctx, cfg) - cfg.SocketPath = testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + cfg.SocketPath = testserver.RunGitalyServer(t, cfg, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterSSHServiceServer(srv, ssh.NewServer( deps.GetLocator(), deps.GetGitCmdFactory(), diff --git a/internal/git/remoterepo/testhelper_test.go b/internal/git/remoterepo/testhelper_test.go index 2ce973ff7..9cec2bd61 100644 --- a/internal/git/remoterepo/testhelper_test.go +++ b/internal/git/remoterepo/testhelper_test.go @@ -22,7 +22,7 @@ func TestMain(m *testing.M) { func setupGitalyServer(t *testing.T) config.Cfg { cfg := testcfg.Build(t) - cfg.SocketPath = testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + cfg.SocketPath = testserver.RunGitalyServer(t, cfg, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterRepositoryServiceServer(srv, repository.NewServer( deps.GetCfg(), deps.GetLocator(), diff --git a/internal/git/updateref/update_with_hooks_test.go b/internal/git/updateref/update_with_hooks_test.go index 8e2edaef3..aa34632a2 100644 --- a/internal/git/updateref/update_with_hooks_test.go +++ b/internal/git/updateref/update_with_hooks_test.go @@ -97,7 +97,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, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterHookServiceServer(srv, hookservice.NewServer(deps.GetHookManager(), deps.GetGitCmdFactory(), deps.GetPackObjectsCache(), deps.GetPackObjectsConcurrencyTracker(), deps.GetPackObjectsLimiter())) }) diff --git a/internal/gitaly/config/locator_test.go b/internal/gitaly/config/locator_test.go index 38e5d7ce2..1887218ea 100644 --- a/internal/gitaly/config/locator_test.go +++ b/internal/gitaly/config/locator_test.go @@ -29,7 +29,7 @@ func TestConfigLocator_GetRepoPath(t *testing.T) { const storageName = "exists" cfg := testcfg.Build(t, testcfg.WithStorages(storageName, "removed")) - cfg.SocketPath = testserver.RunGitalyServer(t, cfg, nil, setup.RegisterAll) + cfg.SocketPath = testserver.RunGitalyServer(t, cfg, setup.RegisterAll) locator := config.NewLocator(cfg) repo, repoPath := gittest.CreateRepository(t, ctx, cfg) @@ -121,7 +121,7 @@ func TestConfigLocator_GetPath(t *testing.T) { const storageName = "exists" ctx := testhelper.Context(t) cfg := testcfg.Build(t, testcfg.WithStorages(storageName, "removed")) - cfg.SocketPath = testserver.RunGitalyServer(t, cfg, nil, setup.RegisterAll) + cfg.SocketPath = testserver.RunGitalyServer(t, cfg, setup.RegisterAll) repo, _ := gittest.CreateRepository(t, ctx, cfg) // The storage name still present in the storages list, but not on the disk. diff --git a/internal/gitaly/service/blob/testhelper_test.go b/internal/gitaly/service/blob/testhelper_test.go index 2c80c4fbb..7de0426ff 100644 --- a/internal/gitaly/service/blob/testhelper_test.go +++ b/internal/gitaly/service/blob/testhelper_test.go @@ -23,7 +23,7 @@ func TestMain(m *testing.M) { func setup(tb testing.TB, ctx context.Context) (config.Cfg, gitalypb.BlobServiceClient) { cfg := testcfg.Build(tb) - addr := testserver.RunGitalyServer(tb, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + addr := testserver.RunGitalyServer(tb, cfg, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterBlobServiceServer(srv, NewServer( deps.GetLocator(), deps.GetGitCmdFactory(), diff --git a/internal/gitaly/service/cleanup/testhelper_test.go b/internal/gitaly/service/cleanup/testhelper_test.go index 6ff7d25bb..f98306b3f 100644 --- a/internal/gitaly/service/cleanup/testhelper_test.go +++ b/internal/gitaly/service/cleanup/testhelper_test.go @@ -34,7 +34,7 @@ func setupCleanupService(t *testing.T, ctx context.Context) (config.Cfg, *gitaly } 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, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterCleanupServiceServer(srv, NewServer( deps.GetLocator(), deps.GetGitCmdFactory(), diff --git a/internal/gitaly/service/commit/testhelper_test.go b/internal/gitaly/service/commit/testhelper_test.go index ab28e432c..ed172df80 100644 --- a/internal/gitaly/service/commit/testhelper_test.go +++ b/internal/gitaly/service/commit/testhelper_test.go @@ -71,7 +71,7 @@ func setupCommitServiceCreateRepo( func startTestServices(tb testing.TB, cfg config.Cfg, opts ...testserver.GitalyServerOpt) string { tb.Helper() - return testserver.RunGitalyServer(tb, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + return testserver.RunGitalyServer(tb, cfg, func(srv *grpc.Server, 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 b780be96b..56177c213 100644 --- a/internal/gitaly/service/conflicts/testhelper_test.go +++ b/internal/gitaly/service/conflicts/testhelper_test.go @@ -45,7 +45,7 @@ func setupConflictsService(tb testing.TB, ctx context.Context, hookManager hook. } func runConflictsServer(tb testing.TB, cfg config.Cfg, hookManager hook.Manager) string { - return testserver.RunGitalyServer(tb, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + return testserver.RunGitalyServer(tb, cfg, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterConflictsServiceServer(srv, NewServer( deps.GetHookManager(), deps.GetLocator(), diff --git a/internal/gitaly/service/dependencies.go b/internal/gitaly/service/dependencies.go index ef52af062..b2c31cab2 100644 --- a/internal/gitaly/service/dependencies.go +++ b/internal/gitaly/service/dependencies.go @@ -11,7 +11,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v15/internal/git2go" "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/config" gitalyhook "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/hook" - "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/rubyserver" "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/storage" "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/transaction" "gitlab.com/gitlab-org/gitaly/v15/internal/gitlab" @@ -22,7 +21,6 @@ import ( // Dependencies assembles set of components required by different kinds of services. type Dependencies struct { Cfg config.Cfg - RubyServer *rubyserver.Server GitalyHookManager gitalyhook.Manager TransactionManager transaction.Manager StorageLocator storage.Locator @@ -46,11 +44,6 @@ func (dc *Dependencies) GetCfg() config.Cfg { return dc.Cfg } -// GetRubyServer returns client for the ruby processes. -func (dc *Dependencies) GetRubyServer() *rubyserver.Server { - return dc.RubyServer -} - // GetHookManager returns hook manager. func (dc *Dependencies) GetHookManager() gitalyhook.Manager { return dc.GitalyHookManager diff --git a/internal/gitaly/service/diff/testhelper_test.go b/internal/gitaly/service/diff/testhelper_test.go index b82068c41..6e49907a1 100644 --- a/internal/gitaly/service/diff/testhelper_test.go +++ b/internal/gitaly/service/diff/testhelper_test.go @@ -34,7 +34,7 @@ func setupDiffService(tb testing.TB, ctx context.Context, opt ...testserver.Gita func setupDiffServiceWithoutRepo(tb testing.TB, opt ...testserver.GitalyServerOpt) (config.Cfg, gitalypb.DiffServiceClient) { cfg := testcfg.Build(tb) - addr := testserver.RunGitalyServer(tb, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + addr := testserver.RunGitalyServer(tb, cfg, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterDiffServiceServer(srv, NewServer( deps.GetLocator(), deps.GetGitCmdFactory(), diff --git a/internal/gitaly/service/hook/testhelper_test.go b/internal/gitaly/service/hook/testhelper_test.go index d5d82ae44..4e12f14df 100644 --- a/internal/gitaly/service/hook/testhelper_test.go +++ b/internal/gitaly/service/hook/testhelper_test.go @@ -59,7 +59,7 @@ func runHooksServer(tb testing.TB, cfg config.Cfg, opts []serverOption, serverOp serverOpts = append(serverOpts, testserver.WithDisablePraefect()) - return testserver.RunGitalyServer(tb, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + return testserver.RunGitalyServer(tb, cfg, func(srv *grpc.Server, deps *service.Dependencies) { hookServer := NewServer( gitalyhook.NewManager(deps.GetCfg(), deps.GetLocator(), deps.GetGitCmdFactory(), deps.GetTxManager(), deps.GetGitlabClient()), deps.GetGitCmdFactory(), diff --git a/internal/gitaly/service/internalgitaly/testhelper_test.go b/internal/gitaly/service/internalgitaly/testhelper_test.go index 62e8c8dc3..28019fd58 100644 --- a/internal/gitaly/service/internalgitaly/testhelper_test.go +++ b/internal/gitaly/service/internalgitaly/testhelper_test.go @@ -18,7 +18,7 @@ func TestMain(m *testing.M) { } 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, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterInternalGitalyServer(srv, internalService) }, testserver.WithDisablePraefect()) conn, err := grpc.Dial(add, grpc.WithTransportCredentials(insecure.NewCredentials())) diff --git a/internal/gitaly/service/namespace/testhelper_test.go b/internal/gitaly/service/namespace/testhelper_test.go index 2fba9813b..ff40cd749 100644 --- a/internal/gitaly/service/namespace/testhelper_test.go +++ b/internal/gitaly/service/namespace/testhelper_test.go @@ -20,7 +20,7 @@ func setupNamespaceService(tb testing.TB, opts ...testserver.GitalyServerOpt) (c cfgBuilder := testcfg.NewGitalyCfgBuilder(testcfg.WithStorages("default", "other")) cfg := cfgBuilder.Build(tb) - addr := testserver.RunGitalyServer(tb, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + addr := testserver.RunGitalyServer(tb, cfg, func(srv *grpc.Server, 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 3037626e5..bfdf19387 100644 --- a/internal/gitaly/service/objectpool/testhelper_test.go +++ b/internal/gitaly/service/objectpool/testhelper_test.go @@ -64,7 +64,7 @@ func setupWithConfig(t *testing.T, ctx context.Context, cfg config.Cfg, opts ... } 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, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterObjectPoolServiceServer(srv, NewServer( deps.GetLocator(), deps.GetGitCmdFactory(), diff --git a/internal/gitaly/service/operations/branches_test.go b/internal/gitaly/service/operations/branches_test.go index 108feb9ac..51039aa8d 100644 --- a/internal/gitaly/service/operations/branches_test.go +++ b/internal/gitaly/service/operations/branches_test.go @@ -135,7 +135,7 @@ func TestUserCreateBranch_Transactions(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, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterOperationServiceServer(srv, NewServer( deps.GetHookManager(), deps.GetTxManager(), @@ -811,7 +811,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, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterOperationServiceServer(srv, NewServer( deps.GetHookManager(), deps.GetTxManager(), diff --git a/internal/gitaly/service/operations/testhelper_test.go b/internal/gitaly/service/operations/testhelper_test.go index 8b3da3d3d..f023577cf 100644 --- a/internal/gitaly/service/operations/testhelper_test.go +++ b/internal/gitaly/service/operations/testhelper_test.go @@ -91,7 +91,7 @@ func setupOperationsServiceWithoutRepo( func runOperationServiceServer(tb testing.TB, cfg config.Cfg, options ...testserver.GitalyServerOpt) string { tb.Helper() - return testserver.RunGitalyServer(tb, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + return testserver.RunGitalyServer(tb, cfg, func(srv *grpc.Server, deps *service.Dependencies) { operationServer := NewServer( deps.GetHookManager(), deps.GetTxManager(), diff --git a/internal/gitaly/service/ref/delete_refs_test.go b/internal/gitaly/service/ref/delete_refs_test.go index 012804852..4fc8a53d8 100644 --- a/internal/gitaly/service/ref/delete_refs_test.go +++ b/internal/gitaly/service/ref/delete_refs_test.go @@ -121,7 +121,7 @@ func testDeleteRefsTransaction(t *testing.T, ctx context.Context) { txManager := transaction.NewTrackingManager() - addr := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + addr := testserver.RunGitalyServer(t, cfg, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterRefServiceServer(srv, NewServer( deps.GetLocator(), deps.GetGitCmdFactory(), diff --git a/internal/gitaly/service/ref/testhelper_test.go b/internal/gitaly/service/ref/testhelper_test.go index b2551b31c..ed60e9561 100644 --- a/internal/gitaly/service/ref/testhelper_test.go +++ b/internal/gitaly/service/ref/testhelper_test.go @@ -60,7 +60,7 @@ func setupRefServiceWithoutRepo(tb testing.TB) (config.Cfg, gitalypb.RefServiceC } func runRefServiceServer(tb testing.TB, cfg config.Cfg) string { - return testserver.RunGitalyServer(tb, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + return testserver.RunGitalyServer(tb, cfg, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterRefServiceServer(srv, NewServer( deps.GetLocator(), deps.GetGitCmdFactory(), diff --git a/internal/gitaly/service/remote/testhelper_test.go b/internal/gitaly/service/remote/testhelper_test.go index d3baa5661..136b0f942 100644 --- a/internal/gitaly/service/remote/testhelper_test.go +++ b/internal/gitaly/service/remote/testhelper_test.go @@ -24,7 +24,7 @@ func setupRemoteService(t *testing.T, ctx context.Context, opts ...testserver.Gi cfg := testcfg.Build(t) - addr := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + addr := testserver.RunGitalyServer(t, cfg, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterRemoteServiceServer(srv, NewServer( deps.GetLocator(), deps.GetGitCmdFactory(), diff --git a/internal/gitaly/service/remote/update_remote_mirror_test.go b/internal/gitaly/service/remote/update_remote_mirror_test.go index ecd969f5c..bcab15000 100644 --- a/internal/gitaly/service/remote/update_remote_mirror_test.go +++ b/internal/gitaly/service/remote/update_remote_mirror_test.go @@ -565,7 +565,7 @@ func TestUpdateRemoteMirror(t *testing.T) { ctx := testhelper.Context(t) cfg := testcfg.Build(t) - addr := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + addr := testserver.RunGitalyServer(t, cfg, func(srv *grpc.Server, deps *service.Dependencies) { cmdFactory := deps.GetGitCmdFactory() if tc.wrapCommandFactory != nil { cmdFactory = tc.wrapCommandFactory(t, deps.GetGitCmdFactory()) diff --git a/internal/gitaly/service/repository/testhelper_test.go b/internal/gitaly/service/repository/testhelper_test.go index fdcecc6b4..13962ce3b 100644 --- a/internal/gitaly/service/repository/testhelper_test.go +++ b/internal/gitaly/service/repository/testhelper_test.go @@ -83,7 +83,7 @@ func assertModTimeAfter(t *testing.T, afterTime time.Time, paths ...string) bool } func runRepositoryService(tb testing.TB, cfg config.Cfg, opts ...testserver.GitalyServerOpt) (gitalypb.RepositoryServiceClient, string) { - serverSocketPath := testserver.RunGitalyServer(tb, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + serverSocketPath := testserver.RunGitalyServer(tb, cfg, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterRepositoryServiceServer(srv, NewServer( cfg, deps.GetLocator(), diff --git a/internal/gitaly/service/server/info_test.go b/internal/gitaly/service/server/info_test.go index 8f31fdb25..acdb05849 100644 --- a/internal/gitaly/service/server/info_test.go +++ b/internal/gitaly/service/server/info_test.go @@ -58,7 +58,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, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterServerServiceServer(srv, NewServer(deps.GetGitCmdFactory(), deps.GetCfg().Storages)) }, opts...) } diff --git a/internal/gitaly/service/smarthttp/testhelper_test.go b/internal/gitaly/service/smarthttp/testhelper_test.go index 53486cbf1..55d4429b5 100644 --- a/internal/gitaly/service/smarthttp/testhelper_test.go +++ b/internal/gitaly/service/smarthttp/testhelper_test.go @@ -28,7 +28,7 @@ func TestMain(m *testing.M) { } func startSmartHTTPServerWithOptions(t *testing.T, cfg config.Cfg, opts []ServerOpt, serverOpts []testserver.GitalyServerOpt) testserver.GitalyServer { - return testserver.StartGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + return testserver.StartGitalyServer(t, cfg, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterSmartHTTPServiceServer(srv, NewServer( deps.GetLocator(), deps.GetGitCmdFactory(), diff --git a/internal/gitaly/service/ssh/testhelper_test.go b/internal/gitaly/service/ssh/testhelper_test.go index 3ce421836..4c910edc3 100644 --- a/internal/gitaly/service/ssh/testhelper_test.go +++ b/internal/gitaly/service/ssh/testhelper_test.go @@ -28,7 +28,7 @@ func runSSHServerWithOptions(t *testing.T, cfg config.Cfg, opts []ServerOpt, ser } func startSSHServerWithOptions(t *testing.T, cfg config.Cfg, opts []ServerOpt, serverOpts ...testserver.GitalyServerOpt) testserver.GitalyServer { - return testserver.StartGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + return testserver.StartGitalyServer(t, cfg, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterSSHServiceServer(srv, NewServer( deps.GetLocator(), deps.GetGitCmdFactory(), diff --git a/internal/gitaly/transaction/manager_test.go b/internal/gitaly/transaction/manager_test.go index 4dff12fd7..30b4ce7c1 100644 --- a/internal/gitaly/transaction/manager_test.go +++ b/internal/gitaly/transaction/manager_test.go @@ -229,7 +229,7 @@ func TestPoolManager_Stop(t *testing.T) { func runTransactionServer(t *testing.T, cfg config.Cfg) (*testTransactionServer, string) { transactionServer := &testTransactionServer{} cfg.ListenAddr = "localhost: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, func(srv *grpc.Server, 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 7b101c03c..a19210981 100644 --- a/internal/praefect/coordinator_test.go +++ b/internal/praefect/coordinator_test.go @@ -968,7 +968,7 @@ func runMockMaintenanceServer(t *testing.T, cfg gconfig.Cfg) (*mockMaintenanceSe requestCh: make(chan proto.Message, 1), } - addr := testserver.RunGitalyServer(t, cfg, nil, func(srv *grpc.Server, deps *service.Dependencies) { + addr := testserver.RunGitalyServer(t, cfg, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterRepositoryServiceServer(srv, server) gitalypb.RegisterRefServiceServer(srv, server) }, testserver.WithDisablePraefect()) @@ -2117,7 +2117,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, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterOperationServiceServer(srv, operationServer) }, testserver.WithDiskCache(&mockDiskCache{}), testserver.WithDisablePraefect()) diff --git a/internal/praefect/info_service_test.go b/internal/praefect/info_service_test.go index f271144cb..96de9d97b 100644 --- a/internal/praefect/info_service_test.go +++ b/internal/praefect/info_service_test.go @@ -37,7 +37,7 @@ func TestInfoService_RepositoryReplicas(t *testing.T) { for i, storage := range storages { cfg := testcfg.Build(t, testcfg.WithStorages(storage)) 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], func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterRepositoryServiceServer(srv, repository.NewServer( deps.GetCfg(), deps.GetLocator(), diff --git a/internal/praefect/remove_all_test.go b/internal/praefect/remove_all_test.go index add4fc3f3..52a0009b9 100644 --- a/internal/praefect/remove_all_test.go +++ b/internal/praefect/remove_all_test.go @@ -37,12 +37,12 @@ func TestRemoveAllHandler(t *testing.T) { const gitaly1Storage = "gitaly-1" gitaly1Cfg := testcfg.Build(t, testcfg.WithStorages(gitaly1Storage)) gitaly1RepoPath := filepath.Join(gitaly1Cfg.Storages[0].Path, relativePath) - gitaly1Addr := testserver.RunGitalyServer(t, gitaly1Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + gitaly1Addr := testserver.RunGitalyServer(t, gitaly1Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) const gitaly2Storage = "gitaly-2" gitaly2Cfg := testcfg.Build(t, testcfg.WithStorages(gitaly2Storage)) gitaly2RepoPath := filepath.Join(gitaly2Cfg.Storages[0].Path, relativePath) - gitaly2Addr := testserver.RunGitalyServer(t, gitaly2Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + gitaly2Addr := testserver.RunGitalyServer(t, gitaly2Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) cfg := config.Config{VirtualStorages: []*config.VirtualStorage{ { diff --git a/internal/praefect/remove_repository_test.go b/internal/praefect/remove_repository_test.go index 2d5c4d34d..f90bac677 100644 --- a/internal/praefect/remove_repository_test.go +++ b/internal/praefect/remove_repository_test.go @@ -66,12 +66,12 @@ func TestRemoveRepositoryHandler(t *testing.T) { const gitaly1Storage = "gitaly-1" gitaly1Cfg := testcfg.Build(t, testcfg.WithStorages(gitaly1Storage)) gitaly1RepoPath := filepath.Join(gitaly1Cfg.Storages[0].Path, relativePath) - gitaly1Addr := testserver.RunGitalyServer(t, gitaly1Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + gitaly1Addr := testserver.RunGitalyServer(t, gitaly1Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) const gitaly2Storage = "gitaly-2" gitaly2Cfg := testcfg.Build(t, testcfg.WithStorages(gitaly2Storage)) gitaly2RepoPath := filepath.Join(gitaly2Cfg.Storages[0].Path, relativePath) - gitaly2Addr := testserver.RunGitalyServer(t, gitaly2Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + gitaly2Addr := testserver.RunGitalyServer(t, gitaly2Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) cfg := config.Config{VirtualStorages: []*config.VirtualStorage{ { diff --git a/internal/praefect/replicator_test.go b/internal/praefect/replicator_test.go index 16604c057..2659eb0a6 100644 --- a/internal/praefect/replicator_test.go +++ b/internal/praefect/replicator_test.go @@ -58,12 +58,12 @@ func TestReplMgr_ProcessBacklog(t *testing.T) { }) testRepo := localrepo.NewTestRepo(t, primaryCfg, testRepoProto) - primaryCfg.SocketPath = testserver.RunGitalyServer(t, primaryCfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + primaryCfg.SocketPath = testserver.RunGitalyServer(t, primaryCfg, setup.RegisterAll, testserver.WithDisablePraefect()) testcfg.BuildGitalySSH(t, primaryCfg) testcfg.BuildGitalyHooks(t, primaryCfg) backupCfg := testcfg.Build(t, testcfg.WithStorages("backup")) - backupCfg.SocketPath = testserver.RunGitalyServer(t, backupCfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + backupCfg.SocketPath = testserver.RunGitalyServer(t, backupCfg, setup.RegisterAll, testserver.WithDisablePraefect()) testcfg.BuildGitalySSH(t, backupCfg) testcfg.BuildGitalyHooks(t, backupCfg) @@ -293,7 +293,7 @@ func TestConfirmReplication(t *testing.T) { Seed: gittest.SeedGitLabTest, }) - srvSocketPath := testserver.RunGitalyServer(t, cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + srvSocketPath := testserver.RunGitalyServer(t, cfg, setup.RegisterAll, testserver.WithDisablePraefect()) testRepoB, _ := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{ SkipCreationViaService: true, @@ -362,10 +362,10 @@ func TestProcessBacklog_FailedJobs(t *testing.T) { SkipCreationViaService: true, Seed: gittest.SeedGitLabTest, }) - primaryAddr := testserver.RunGitalyServer(t, primaryCfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + primaryAddr := testserver.RunGitalyServer(t, primaryCfg, setup.RegisterAll, testserver.WithDisablePraefect()) backupCfg := testcfg.Build(t, testcfg.WithStorages("backup")) - backupAddr := testserver.RunGitalyServer(t, backupCfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + backupAddr := testserver.RunGitalyServer(t, backupCfg, setup.RegisterAll, testserver.WithDisablePraefect()) testcfg.BuildGitalySSH(t, backupCfg) testcfg.BuildGitalyHooks(t, backupCfg) @@ -468,7 +468,7 @@ func TestProcessBacklog_Success(t *testing.T) { ctx, cancel := context.WithCancel(ctx) primaryCfg := testcfg.Build(t, testcfg.WithStorages("primary")) - primaryCfg.SocketPath = testserver.RunGitalyServer(t, primaryCfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + primaryCfg.SocketPath = testserver.RunGitalyServer(t, primaryCfg, setup.RegisterAll, testserver.WithDisablePraefect()) testcfg.BuildGitalySSH(t, primaryCfg) testcfg.BuildGitalyHooks(t, primaryCfg) @@ -478,7 +478,7 @@ func TestProcessBacklog_Success(t *testing.T) { }) backupCfg := testcfg.Build(t, testcfg.WithStorages("backup")) - backupCfg.SocketPath = testserver.RunGitalyServer(t, backupCfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + backupCfg.SocketPath = testserver.RunGitalyServer(t, backupCfg, setup.RegisterAll, testserver.WithDisablePraefect()) testcfg.BuildGitalySSH(t, backupCfg) testcfg.BuildGitalyHooks(t, backupCfg) diff --git a/internal/praefect/repocleaner/repository_test.go b/internal/praefect/repocleaner/repository_test.go index 5a70bb4b6..c28f64492 100644 --- a/internal/praefect/repocleaner/repository_test.go +++ b/internal/praefect/repocleaner/repository_test.go @@ -47,9 +47,9 @@ func TestRunner_Run(t *testing.T) { g2Cfg := testcfg.Build(t, testcfg.WithStorages(storage2)) g3Cfg := testcfg.Build(t, testcfg.WithStorages(storage3)) - g1Addr := testserver.RunGitalyServer(t, g1Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) - g2Addr := testserver.RunGitalyServer(t, g2Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) - g3Addr := testserver.RunGitalyServer(t, g3Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + g1Addr := testserver.RunGitalyServer(t, g1Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) + g2Addr := testserver.RunGitalyServer(t, g2Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) + g3Addr := testserver.RunGitalyServer(t, g3Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) db := testdb.New(t) dbConf := testdb.GetConfig(t, db.Name) @@ -230,7 +230,7 @@ func TestRunner_Run_noAvailableStorages(t *testing.T) { ) g1Cfg := testcfg.Build(t, testcfg.WithStorages(storage1)) - g1Addr := testserver.RunGitalyServer(t, g1Cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + g1Addr := testserver.RunGitalyServer(t, g1Cfg, setup.RegisterAll, testserver.WithDisablePraefect()) db := testdb.New(t) dbConf := testdb.GetConfig(t, db.Name) diff --git a/internal/praefect/server_factory_test.go b/internal/praefect/server_factory_test.go index d958c99dd..cd724fe4a 100644 --- a/internal/praefect/server_factory_test.go +++ b/internal/praefect/server_factory_test.go @@ -47,7 +47,7 @@ func TestServerFactory(t *testing.T) { ctx := testhelper.Context(t) cfg := testcfg.Build(t) - gitalyAddr := testserver.RunGitalyServer(t, cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + gitalyAddr := testserver.RunGitalyServer(t, cfg, setup.RegisterAll, testserver.WithDisablePraefect()) repo, repoPath := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{ SkipCreationViaService: true, diff --git a/internal/praefect/server_test.go b/internal/praefect/server_test.go index c8240fa06..3e9820330 100644 --- a/internal/praefect/server_test.go +++ b/internal/praefect/server_test.go @@ -123,10 +123,10 @@ func TestGitalyServerInfo(t *testing.T) { t.Run("gitaly responds with ok", func(t *testing.T) { firstCfg := testcfg.Build(t, testcfg.WithStorages("praefect-internal-1")) - firstCfg.SocketPath = testserver.RunGitalyServer(t, firstCfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + firstCfg.SocketPath = testserver.RunGitalyServer(t, firstCfg, setup.RegisterAll, testserver.WithDisablePraefect()) secondCfg := testcfg.Build(t, testcfg.WithStorages("praefect-internal-2")) - secondCfg.SocketPath = testserver.RunGitalyServer(t, secondCfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + secondCfg.SocketPath = testserver.RunGitalyServer(t, secondCfg, setup.RegisterAll, testserver.WithDisablePraefect()) require.NoError(t, storage.WriteMetadataFile(firstCfg.Storages[0].Path)) firstMetadata, err := storage.ReadMetadataFile(firstCfg.Storages[0].Path) @@ -284,7 +284,7 @@ func TestDiskStatistics(t *testing.T) { for _, name := range []string{"gitaly-1", "gitaly-2"} { gitalyCfg := testcfg.Build(t) - gitalyAddr := testserver.RunGitalyServer(t, gitalyCfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + gitalyAddr := testserver.RunGitalyServer(t, gitalyCfg, setup.RegisterAll, testserver.WithDisablePraefect()) praefectCfg.VirtualStorages[0].Nodes = append(praefectCfg.VirtualStorages[0].Nodes, &config.Node{ Storage: name, @@ -509,7 +509,7 @@ func TestRemoveRepository(t *testing.T) { RelativePath: t.Name(), }) - gitalyAddr := testserver.RunGitalyServer(t, gitalyCfgs[i], nil, setup.RegisterAll, testserver.WithDisablePraefect()) + gitalyAddr := testserver.RunGitalyServer(t, gitalyCfgs[i], setup.RegisterAll, testserver.WithDisablePraefect()) gitalyCfgs[i].SocketPath = gitalyAddr praefectCfg.VirtualStorages[0].Nodes = append(praefectCfg.VirtualStorages[0].Nodes, &config.Node{ @@ -589,7 +589,7 @@ func TestRenameRepository(t *testing.T) { for _, storageName := range gitalyStorages { cfgBuilder := testcfg.NewGitalyCfgBuilder(testcfg.WithStorages(storageName)) gitalyCfg := cfgBuilder.Build(t) - gitalyAddr := testserver.RunGitalyServer(t, gitalyCfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + gitalyAddr := testserver.RunGitalyServer(t, gitalyCfg, setup.RegisterAll, testserver.WithDisablePraefect()) praefectCfg.VirtualStorages[0].Nodes = append(praefectCfg.VirtualStorages[0].Nodes, &config.Node{ Storage: storageName, @@ -768,7 +768,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, func(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterSmartHTTPServiceServer(srv, smartHTTPService) }, testserver.WithDisablePraefect()) } diff --git a/internal/praefect/service/server/readiness_test.go b/internal/praefect/service/server/readiness_test.go index 85d434fc9..4cbc222ad 100644 --- a/internal/praefect/service/server/readiness_test.go +++ b/internal/praefect/service/server/readiness_test.go @@ -35,7 +35,7 @@ func TestServer_ReadinessCheck(t *testing.T) { const gitalyStorageName = "praefect-internal-0" gitalyCfg := testcfg.Build(t, testcfg.WithStorages(gitalyStorageName)) - gitalyAddr := testserver.RunGitalyServer(t, gitalyCfg, nil, setup.RegisterAll, testserver.WithDisablePraefect()) + gitalyAddr := testserver.RunGitalyServer(t, gitalyCfg, setup.RegisterAll, testserver.WithDisablePraefect()) praefectConf := config.Config{ SocketPath: testhelper.GetTemporaryGitalySocketFileName(t), diff --git a/internal/praefect/verifier_test.go b/internal/praefect/verifier_test.go index 919476cee..375d7e7fc 100644 --- a/internal/praefect/verifier_test.go +++ b/internal/praefect/verifier_test.go @@ -493,7 +493,7 @@ func TestVerifier(t *testing.T) { } cfg := testcfg.Build(t, testcfg.WithStorages(storageName)) - cfg.SocketPath = testserver.RunGitalyServer(t, cfg, nil, registerFunc, testserver.WithDisablePraefect()) + cfg.SocketPath = testserver.RunGitalyServer(t, cfg, registerFunc, testserver.WithDisablePraefect()) conf.VirtualStorages[0].Nodes = append(conf.VirtualStorages[0].Nodes, &config.Node{ Storage: storageName, Address: cfg.SocketPath, diff --git a/internal/testhelper/testserver/gitaly.go b/internal/testhelper/testserver/gitaly.go index 9f69e69da..b74677572 100644 --- a/internal/testhelper/testserver/gitaly.go +++ b/internal/testhelper/testserver/gitaly.go @@ -24,7 +24,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/config/auth" gitalylog "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/config/log" "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/hook" - "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/rubyserver" "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/server" "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/service" "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/storage" @@ -46,13 +45,13 @@ 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(tb testing.TB, cfg config.Cfg, rubyServer *rubyserver.Server, registrar func(srv *grpc.Server, deps *service.Dependencies), opts ...GitalyServerOpt) string { - return StartGitalyServer(tb, cfg, rubyServer, registrar, opts...).Address() +func RunGitalyServer(tb testing.TB, cfg config.Cfg, registrar func(srv *grpc.Server, deps *service.Dependencies), opts ...GitalyServerOpt) string { + return StartGitalyServer(tb, cfg, registrar, opts...).Address() } // StartGitalyServer creates and runs gitaly (and praefect as a proxy) server. -func StartGitalyServer(tb testing.TB, cfg config.Cfg, rubyServer *rubyserver.Server, registrar func(srv *grpc.Server, deps *service.Dependencies), opts ...GitalyServerOpt) GitalyServer { - gitalySrv, gitalyAddr, disablePraefect := runGitaly(tb, cfg, rubyServer, registrar, opts...) +func StartGitalyServer(tb testing.TB, cfg config.Cfg, registrar func(srv *grpc.Server, deps *service.Dependencies), opts ...GitalyServerOpt) GitalyServer { + gitalySrv, gitalyAddr, disablePraefect := runGitaly(tb, cfg, registrar, opts...) if !testhelper.IsPraefectEnabled() || disablePraefect { return GitalyServer{ @@ -155,7 +154,7 @@ func waitHealthy(tb testing.TB, ctx context.Context, addr string, authToken stri require.Equal(tb, healthpb.HealthCheckResponse_SERVING, resp.Status, "server not yet ready to serve") } -func runGitaly(tb testing.TB, cfg config.Cfg, rubyServer *rubyserver.Server, registrar func(srv *grpc.Server, deps *service.Dependencies), opts ...GitalyServerOpt) (*grpc.Server, string, bool) { +func runGitaly(tb testing.TB, cfg config.Cfg, registrar func(srv *grpc.Server, deps *service.Dependencies), opts ...GitalyServerOpt) (*grpc.Server, string, bool) { tb.Helper() var gsd gitalyServerDeps @@ -170,7 +169,7 @@ func runGitaly(tb testing.TB, cfg config.Cfg, rubyServer *rubyserver.Server, reg server.WithStreamInterceptor(structerr.StreamInterceptor), } - deps := gsd.createDependencies(tb, cfg, rubyServer) + deps := gsd.createDependencies(tb, cfg) tb.Cleanup(func() { gsd.conns.Close() }) serverFactory := server.NewGitalyServerFactory( @@ -270,7 +269,7 @@ type gitalyServerDeps struct { housekeepingManager housekeeping.Manager } -func (gsd *gitalyServerDeps) createDependencies(tb testing.TB, cfg config.Cfg, rubyServer *rubyserver.Server) *service.Dependencies { +func (gsd *gitalyServerDeps) createDependencies(tb testing.TB, cfg config.Cfg) *service.Dependencies { if gsd.logger == nil { gsd.logger = testhelper.NewGitalyServerLogger(tb) } @@ -351,7 +350,6 @@ func (gsd *gitalyServerDeps) createDependencies(tb testing.TB, cfg config.Cfg, r return &service.Dependencies{ Cfg: cfg, - RubyServer: rubyServer, ClientPool: gsd.conns, StorageLocator: gsd.locator, TransactionManager: gsd.txMgr, |