diff options
author | John Cai <jcai@gitlab.com> | 2022-05-13 18:15:15 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2022-05-16 15:39:08 +0300 |
commit | ae5e48879695dd46c3297a62bc81e8e591cd391a (patch) | |
tree | 2a35300fc414aa84a84e6ef98f32fb0b20d6e2a7 | |
parent | db39afe369d908482b567bd9d27d7e69f9823fd6 (diff) |
repository: Add object pool service to server and client helper
To prepare for tests that need to call the object pool service, include
the object pool service in the server setup. Also, add a method to
create an object pool client.
-rw-r--r-- | internal/gitaly/service/repository/testhelper_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/gitaly/service/repository/testhelper_test.go b/internal/gitaly/service/repository/testhelper_test.go index bd289de33..576516ad0 100644 --- a/internal/gitaly/service/repository/testhelper_test.go +++ b/internal/gitaly/service/repository/testhelper_test.go @@ -20,6 +20,7 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service" "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/commit" hookservice "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/hook" + "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/objectpool" "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/ref" "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/remote" "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/ssh" @@ -76,6 +77,14 @@ func newRepositoryClient(t testing.TB, cfg config.Cfg, serverSocketPath string) return gitalypb.NewRepositoryServiceClient(conn) } +func newObjectPoolClient(t testing.TB, cfg config.Cfg, serverSocketPath string) gitalypb.ObjectPoolServiceClient { + conn, err := gclient.Dial(serverSocketPath, nil) + require.NoError(t, err) + t.Cleanup(func() { require.NoError(t, conn.Close()) }) + + return gitalypb.NewObjectPoolServiceClient(conn) +} + func newMuxedRepositoryClient(t *testing.T, ctx context.Context, cfg config.Cfg, serverSocketPath string, handshaker internalclient.Handshaker) gitalypb.RepositoryServiceClient { conn, err := internalclient.Dial(ctx, serverSocketPath, []grpc.DialOption{ grpc.WithPerRPCCredentials(gitalyauth.RPCCredentialsV2(cfg.Auth.Token)), @@ -139,6 +148,13 @@ func runRepositoryServerWithConfig(t testing.TB, cfg config.Cfg, rubySrv *rubyse nil, deps.GetCatfileCache(), )) + gitalypb.RegisterObjectPoolServiceServer(srv, objectpool.NewServer( + deps.GetLocator(), + deps.GetGitCmdFactory(), + deps.GetCatfileCache(), + deps.GetTxManager(), + deps.GetHousekeepingManager(), + )) }, opts...) } |