diff options
author | Paul Okstad <pokstad@gitlab.com> | 2020-12-03 01:57:30 +0300 |
---|---|---|
committer | Paul Okstad <pokstad@gitlab.com> | 2020-12-03 01:57:30 +0300 |
commit | add5f3dd182c99b4d9e1cf93e45fec1214c00659 (patch) | |
tree | 3dc09c155c0e47ac860152ce098a4af09ff36ab8 | |
parent | 32bbe0bf214e052e107021742e801cffb09b8ca5 (diff) | |
parent | f711936eec3b4df8d913b81ec4427ce572492e3e (diff) |
Merge branch 'ps-omit-redundant-parameter' into 'master'
Remove passing internal socket location as a separate param
See merge request gitlab-org/gitaly!2871
-rw-r--r-- | internal/gitaly/maintenance/optimize_test.go | 2 | ||||
-rw-r--r-- | internal/gitaly/service/operations/testhelper_test.go | 2 | ||||
-rw-r--r-- | internal/gitaly/service/register.go | 2 | ||||
-rw-r--r-- | internal/gitaly/service/repository/replicate.go | 2 | ||||
-rw-r--r-- | internal/gitaly/service/repository/replicate_test.go | 2 | ||||
-rw-r--r-- | internal/gitaly/service/repository/search_files_test.go | 4 | ||||
-rw-r--r-- | internal/gitaly/service/repository/server.go | 28 | ||||
-rw-r--r-- | internal/gitaly/service/repository/testhelper_test.go | 2 | ||||
-rw-r--r-- | internal/praefect/replicator_test.go | 2 | ||||
-rw-r--r-- | internal/praefect/service/info/consistencycheck_test.go | 2 | ||||
-rw-r--r-- | internal/testhelper/testserver/gitaly.go | 2 |
11 files changed, 24 insertions, 26 deletions
diff --git a/internal/gitaly/maintenance/optimize_test.go b/internal/gitaly/maintenance/optimize_test.go index 9b7d082c0..9d9f098ec 100644 --- a/internal/gitaly/maintenance/optimize_test.go +++ b/internal/gitaly/maintenance/optimize_test.go @@ -25,7 +25,7 @@ func (mo *mockOptimizer) OptimizeRepository(ctx context.Context, req *gitalypb.O mo.actual = append(mo.actual, req.Repository) cfg := config.Cfg{Storages: mo.storages} l := config.NewLocator(cfg) - resp, err := repository.NewServer(cfg, nil, l, "").OptimizeRepository(ctx, req) + resp, err := repository.NewServer(cfg, nil, l).OptimizeRepository(ctx, req) assert.NoError(mo.t, err) return resp, err } diff --git a/internal/gitaly/service/operations/testhelper_test.go b/internal/gitaly/service/operations/testhelper_test.go index 53b5b2406..151c7ace4 100644 --- a/internal/gitaly/service/operations/testhelper_test.go +++ b/internal/gitaly/service/operations/testhelper_test.go @@ -91,7 +91,7 @@ func runOperationServiceServerWithRubyServer(t *testing.T, ruby *rubyserver.Serv gitalypb.RegisterOperationServiceServer(srv.GrpcServer(), server) gitalypb.RegisterHookServiceServer(srv.GrpcServer(), hook.NewServer(config.Config, hookManager)) - gitalypb.RegisterRepositoryServiceServer(srv.GrpcServer(), repository.NewServer(config.Config, ruby, locator, config.Config.GitalyInternalSocketPath())) + gitalypb.RegisterRepositoryServiceServer(srv.GrpcServer(), repository.NewServer(config.Config, ruby, locator)) gitalypb.RegisterRefServiceServer(srv.GrpcServer(), ref.NewServer(locator)) gitalypb.RegisterCommitServiceServer(srv.GrpcServer(), commit.NewServer(config.Config, locator)) gitalypb.RegisterSSHServiceServer(srv.GrpcServer(), ssh.NewServer(locator)) diff --git a/internal/gitaly/service/register.go b/internal/gitaly/service/register.go index 37698f2e9..65f898fc7 100644 --- a/internal/gitaly/service/register.go +++ b/internal/gitaly/service/register.go @@ -76,7 +76,7 @@ func RegisterAll(grpcServer *grpc.Server, cfg config.Cfg, rubyServer *rubyserver gitalypb.RegisterNamespaceServiceServer(grpcServer, namespace.NewServer(locator)) gitalypb.RegisterOperationServiceServer(grpcServer, operations.NewServer(cfg, rubyServer, hookManager, locator, conns)) gitalypb.RegisterRefServiceServer(grpcServer, ref.NewServer(locator)) - gitalypb.RegisterRepositoryServiceServer(grpcServer, repository.NewServer(cfg, rubyServer, locator, cfg.GitalyInternalSocketPath())) + gitalypb.RegisterRepositoryServiceServer(grpcServer, repository.NewServer(cfg, rubyServer, locator)) gitalypb.RegisterSSHServiceServer(grpcServer, ssh.NewServer( locator, ssh.WithPackfileNegotiationMetrics(sshPackfileNegotiationMetrics), diff --git a/internal/gitaly/service/repository/replicate.go b/internal/gitaly/service/repository/replicate.go index 992398fb5..8536cb3a8 100644 --- a/internal/gitaly/service/repository/replicate.go +++ b/internal/gitaly/service/repository/replicate.go @@ -254,7 +254,7 @@ func (s *server) syncInfoAttributes(ctx context.Context, in *gitalypb.ReplicateR // newRemoteClient creates a new RemoteClient that talks to the same gitaly server func (s *server) newRemoteClient(ctx context.Context) (gitalypb.RemoteServiceClient, error) { - conn, err := s.conns.Dial(ctx, fmt.Sprintf("unix:%s", s.internalGitalySocket), "") + conn, err := s.conns.Dial(ctx, fmt.Sprintf("unix:%s", s.cfg.GitalyInternalSocketPath()), "") if err != nil { return nil, err } diff --git a/internal/gitaly/service/repository/replicate_test.go b/internal/gitaly/service/repository/replicate_test.go index 3399ccb4c..b62f3ba53 100644 --- a/internal/gitaly/service/repository/replicate_test.go +++ b/internal/gitaly/service/repository/replicate_test.go @@ -363,7 +363,7 @@ func runServerWithBadFetchInternalRemote(t *testing.T) (*grpc.Server, string) { internalListener, err := net.Listen("unix", config.Config.GitalyInternalSocketPath()) require.NoError(t, err) - gitalypb.RegisterRepositoryServiceServer(server, repository.NewServer(config.Config, repository.RubyServer, config.NewLocator(config.Config), config.Config.GitalyInternalSocketPath())) + gitalypb.RegisterRepositoryServiceServer(server, repository.NewServer(config.Config, repository.RubyServer, config.NewLocator(config.Config))) gitalypb.RegisterRemoteServiceServer(server, &mockRemoteServer{}) reflection.Register(server) diff --git a/internal/gitaly/service/repository/search_files_test.go b/internal/gitaly/service/repository/search_files_test.go index 3f8ae74ac..09c00151d 100644 --- a/internal/gitaly/service/repository/search_files_test.go +++ b/internal/gitaly/service/repository/search_files_test.go @@ -212,7 +212,7 @@ func TestSearchFilesByContentLargeFile(t *testing.T) { } func TestSearchFilesByContentFailure(t *testing.T) { - server := NewServer(config.Config, RubyServer, config.NewLocator(config.Config), config.Config.GitalyInternalSocketPath()) + server := NewServer(config.Config, RubyServer, config.NewLocator(config.Config)) testRepo, _, cleanupRepo := testhelper.NewTestRepo(t) defer cleanupRepo() @@ -334,7 +334,7 @@ func TestSearchFilesByNameSuccessful(t *testing.T) { } func TestSearchFilesByNameFailure(t *testing.T) { - server := NewServer(config.Config, RubyServer, config.NewLocator(config.Config), config.Config.GitalyInternalSocketPath()) + server := NewServer(config.Config, RubyServer, config.NewLocator(config.Config)) testCases := []struct { desc string diff --git a/internal/gitaly/service/repository/server.go b/internal/gitaly/service/repository/server.go index 353467b37..c407c6265 100644 --- a/internal/gitaly/service/repository/server.go +++ b/internal/gitaly/service/repository/server.go @@ -9,24 +9,22 @@ import ( ) type server struct { - ruby *rubyserver.Server - conns *client.Pool - internalGitalySocket string - locator storage.Locator - cfg config.Cfg - binDir string - loggingCfg config.Logging + ruby *rubyserver.Server + conns *client.Pool + locator storage.Locator + cfg config.Cfg + binDir string + loggingCfg config.Logging } // NewServer creates a new instance of a gRPC repo server -func NewServer(cfg config.Cfg, rs *rubyserver.Server, locator storage.Locator, internalGitalySocket string) gitalypb.RepositoryServiceServer { +func NewServer(cfg config.Cfg, rs *rubyserver.Server, locator storage.Locator) gitalypb.RepositoryServiceServer { return &server{ - ruby: rs, - locator: locator, - conns: client.NewPool(), - internalGitalySocket: internalGitalySocket, - cfg: cfg, - binDir: cfg.BinDir, - loggingCfg: cfg.Logging, + ruby: rs, + locator: locator, + conns: client.NewPool(), + cfg: cfg, + binDir: cfg.BinDir, + loggingCfg: cfg.Logging, } } diff --git a/internal/gitaly/service/repository/testhelper_test.go b/internal/gitaly/service/repository/testhelper_test.go index a02a63104..31a71a9cf 100644 --- a/internal/gitaly/service/repository/testhelper_test.go +++ b/internal/gitaly/service/repository/testhelper_test.go @@ -108,7 +108,7 @@ func runRepoServerWithConfig(t *testing.T, cfg config.Cfg, locator storage.Locat srv := testhelper.NewServerWithAuth(t, streamInt, unaryInt, cfg.Auth.Token, opts...) - gitalypb.RegisterRepositoryServiceServer(srv.GrpcServer(), NewServer(cfg, RubyServer, locator, config.Config.GitalyInternalSocketPath())) + gitalypb.RegisterRepositoryServiceServer(srv.GrpcServer(), NewServer(cfg, RubyServer, locator)) gitalypb.RegisterHookServiceServer(srv.GrpcServer(), hookservice.NewServer(config.Config, hook.NewManager(hook.GitlabAPIStub, cfg))) require.NoError(t, srv.Start()) diff --git a/internal/praefect/replicator_test.go b/internal/praefect/replicator_test.go index c186eb74f..bfa01a7eb 100644 --- a/internal/praefect/replicator_test.go +++ b/internal/praefect/replicator_test.go @@ -1052,7 +1052,7 @@ func newReplicationService(tb testing.TB) (*grpc.Server, string) { svr := testhelper.NewTestGrpcServer(tb, nil, nil) locator := gitaly_config.NewLocator(gitaly_config.Config) - gitalypb.RegisterRepositoryServiceServer(svr, repository.NewServer(gitaly_config.Config, RubyServer, locator, internalSocketName)) + gitalypb.RegisterRepositoryServiceServer(svr, repository.NewServer(gitaly_config.Config, RubyServer, locator)) gitalypb.RegisterObjectPoolServiceServer(svr, objectpoolservice.NewServer(locator)) gitalypb.RegisterRemoteServiceServer(svr, remote.NewServer(RubyServer, locator)) gitalypb.RegisterSSHServiceServer(svr, ssh.NewServer(locator)) diff --git a/internal/praefect/service/info/consistencycheck_test.go b/internal/praefect/service/info/consistencycheck_test.go index 56092aaf6..373914ee6 100644 --- a/internal/praefect/service/info/consistencycheck_test.go +++ b/internal/praefect/service/info/consistencycheck_test.go @@ -66,7 +66,7 @@ func TestServer_ConsistencyCheck(t *testing.T) { gitalySrv := grpc.NewServer() defer gitalySrv.Stop() - gitalypb.RegisterRepositoryServiceServer(gitalySrv, repository.NewServer(gconfig.Config, nil, gconfig.NewLocator(gconfig.Config), "")) + gitalypb.RegisterRepositoryServiceServer(gitalySrv, repository.NewServer(gconfig.Config, nil, gconfig.NewLocator(gconfig.Config))) gitalypb.RegisterInternalGitalyServer(gitalySrv, internalgitaly.NewServer(gconfig.Config.Storages)) go func() { gitalySrv.Serve(gitalyListener) }() } diff --git a/internal/testhelper/testserver/gitaly.go b/internal/testhelper/testserver/gitaly.go index 143ad3c26..28fffbe64 100644 --- a/internal/testhelper/testserver/gitaly.go +++ b/internal/testhelper/testserver/gitaly.go @@ -51,7 +51,7 @@ func RealGitaly(storages []config.Storage, authToken, internalSocketPath string) healthpb.HealthServer }{ gitalyserver.NewServer(storages), - repository.NewServer(config.Config, RubyServer, config.NewLocator(config.Config), internalSocketPath), + repository.NewServer(config.Config, RubyServer, config.NewLocator(config.Config)), internalgitaly.NewServer(config.Config.Storages), commit.NewServer(config.Config, config.NewLocator(config.Config)), health.NewServer(), |