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:
authorSami Hiltunen <shiltunen@gitlab.com>2022-01-20 12:45:24 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2022-02-01 12:27:49 +0300
commit398049f018fa3ee31f11d16d79537e0c3349f7c3 (patch)
tree1fd3f7ee8ae57fcc72ad020ffbf032b2352fccf9
parent73812bd20cc73c13401f097cf859cc6085430039 (diff)
Create test repository through the API in operation service test setup
This commit changes setupOperationsServiceWithCfg to create the test repository through the API. This ensures Praefect has the chance to create the relevant metadata for the test repository. TestUserApplyPatchTransactional had to be amended as it counts votes and creating the repo in the setup creates some votes.
-rw-r--r--internal/gitaly/service/operations/apply_patch_test.go4
-rw-r--r--internal/gitaly/service/operations/testhelper_test.go6
2 files changed, 8 insertions, 2 deletions
diff --git a/internal/gitaly/service/operations/apply_patch_test.go b/internal/gitaly/service/operations/apply_patch_test.go
index bd0939c30..a1ec0dc41 100644
--- a/internal/gitaly/service/operations/apply_patch_test.go
+++ b/internal/gitaly/service/operations/apply_patch_test.go
@@ -612,6 +612,10 @@ func TestUserApplyPatch_transactional(t *testing.T) {
ctx, _, repoProto, _, client := setupOperationsService(t, ctx, testserver.WithTransactionManager(txManager))
+ // Reset the transaction manager as the setup call above creates a repository which
+ // ends up creating some votes with Praefect enabled.
+ txManager.Reset()
+
ctx, err := txinfo.InjectTransaction(ctx, 1, "node", true)
require.NoError(t, err)
ctx = peer.NewContext(ctx, &peer.Peer{
diff --git a/internal/gitaly/service/operations/testhelper_test.go b/internal/gitaly/service/operations/testhelper_test.go
index 990264428..3c33df632 100644
--- a/internal/gitaly/service/operations/testhelper_test.go
+++ b/internal/gitaly/service/operations/testhelper_test.go
@@ -44,8 +44,6 @@ func setupOperationsService(t testing.TB, ctx context.Context, options ...testse
func setupOperationsServiceWithCfg(
t testing.TB, ctx context.Context, cfg config.Cfg, options ...testserver.GitalyServerOpt,
) (context.Context, config.Cfg, *gitalypb.Repository, string, gitalypb.OperationServiceClient) {
- repo, repoPath := gittest.CloneRepo(t, cfg, cfg.Storages[0])
-
testcfg.BuildGitalySSH(t, cfg)
testcfg.BuildGitalyGit2Go(t, cfg)
testcfg.BuildGitalyHooks(t, cfg)
@@ -59,6 +57,10 @@ func setupOperationsServiceWithCfg(
md := testcfg.GitalyServersMetadataFromCfg(t, cfg)
ctx = testhelper.MergeOutgoingMetadata(ctx, md)
+ repo, repoPath := gittest.CreateRepository(ctx, t, cfg, gittest.CreateRepositoryConfig{
+ Seed: gittest.SeedGitLabTest,
+ })
+
return ctx, cfg, repo, repoPath, client
}