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:
-rw-r--r--internal/gitaly/service/objectpool/create_test.go9
-rw-r--r--internal/gitaly/service/objectpool/testhelper_test.go14
2 files changed, 21 insertions, 2 deletions
diff --git a/internal/gitaly/service/objectpool/create_test.go b/internal/gitaly/service/objectpool/create_test.go
index f7dc13371..09ebca2a9 100644
--- a/internal/gitaly/service/objectpool/create_test.go
+++ b/internal/gitaly/service/objectpool/create_test.go
@@ -143,6 +143,8 @@ func TestDelete(t *testing.T) {
cfg, repoProto, _, _, client := setup(ctx, t)
repo := localrepo.NewTestRepo(t, cfg, repoProto)
+ repositoryClient := gitalypb.NewRepositoryServiceClient(extractConn(client))
+
pool := initObjectPool(t, cfg, cfg.Storages[0])
_, err := client.CreateObjectPool(ctx, &gitalypb.CreateObjectPoolRequest{
ObjectPool: pool.ToProto(),
@@ -203,7 +205,6 @@ func TestDelete(t *testing.T) {
RelativePath: tc.relativePath,
},
}})
-
expectedErr := tc.error
if tc.error == errInvalidPoolDir && testhelper.IsPraefectEnabled() {
expectedErr = helper.ErrNotFound(fmt.Errorf(
@@ -213,6 +214,12 @@ func TestDelete(t *testing.T) {
}
testhelper.RequireGrpcError(t, expectedErr, err)
+
+ response, err := repositoryClient.RepositoryExists(ctx, &gitalypb.RepositoryExistsRequest{
+ Repository: pool.ToProto().GetRepository(),
+ })
+ require.NoError(t, err)
+ require.Equal(t, tc.error != nil, response.GetExists())
})
}
}
diff --git a/internal/gitaly/service/objectpool/testhelper_test.go b/internal/gitaly/service/objectpool/testhelper_test.go
index f0ba73dd8..3ea7f981c 100644
--- a/internal/gitaly/service/objectpool/testhelper_test.go
+++ b/internal/gitaly/service/objectpool/testhelper_test.go
@@ -30,6 +30,18 @@ func TestMain(m *testing.M) {
testhelper.Run(m)
}
+// clientWithConn allows for passing through the ClientConn to tests which need
+// to access other services than ObjectPoolService.
+type clientWithConn struct {
+ gitalypb.ObjectPoolServiceClient
+ conn *grpc.ClientConn
+}
+
+// extractConn returns the underlying ClientConn from the client.
+func extractConn(client gitalypb.ObjectPoolServiceClient) *grpc.ClientConn {
+ return client.(clientWithConn).conn
+}
+
func setup(ctx context.Context, t *testing.T, opts ...testserver.GitalyServerOpt) (config.Cfg, *gitalypb.Repository, string, storage.Locator, gitalypb.ObjectPoolServiceClient) {
t.Helper()
@@ -48,7 +60,7 @@ func setup(ctx context.Context, t *testing.T, opts ...testserver.GitalyServerOpt
Seed: gittest.SeedGitLabTest,
})
- return cfg, repo, repoPath, locator, gitalypb.NewObjectPoolServiceClient(conn)
+ return cfg, repo, repoPath, locator, clientWithConn{ObjectPoolServiceClient: gitalypb.NewObjectPoolServiceClient(conn), conn: conn}
}
func runObjectPoolServer(t *testing.T, cfg config.Cfg, locator storage.Locator, logger *logrus.Logger, opts ...testserver.GitalyServerOpt) string {