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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-05-03 15:10:21 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-05-03 16:55:24 +0300
commit17c17dc58ada42d16eee30c054a968bd55752906 (patch)
treee03e1105028e270eea6ee1903e712d585617fa81
parent8c5730d86e5af8521e625cccfce1d1b4463c48c4 (diff)
conflicts: Drop ability to create test commit service with worktreespks-services-reduce-usage-of-worktrees
There are no tests left which require a worktree for their test setup, and we don't want to encourage anybody adding such tests back in. After all, production never uses non-bare repositories, and thus we don't want to change any assumptions by using them in our tests. Drop the ability to create worktrees in these tests.
-rw-r--r--internal/gitaly/service/conflicts/list_conflict_files_test.go12
-rw-r--r--internal/gitaly/service/conflicts/resolve_conflicts_test.go18
-rw-r--r--internal/gitaly/service/conflicts/testhelper_test.go11
3 files changed, 16 insertions, 25 deletions
diff --git a/internal/gitaly/service/conflicts/list_conflict_files_test.go b/internal/gitaly/service/conflicts/list_conflict_files_test.go
index e0ba4c8b7..b0c502408 100644
--- a/internal/gitaly/service/conflicts/list_conflict_files_test.go
+++ b/internal/gitaly/service/conflicts/list_conflict_files_test.go
@@ -20,7 +20,7 @@ type conflictFile struct {
func TestSuccessfulListConflictFilesRequest(t *testing.T) {
ctx := testhelper.Context(t)
- _, repo, _, client := SetupConflictsService(ctx, t, true, nil)
+ _, repo, _, client := setupConflictsService(ctx, t, nil)
ourCommitOid := "1a35b5a77cf6af7edf6703f88e82f6aff613666f"
theirCommitOid := "8309e68585b28d61eb85b7e2834849dda6bf1733"
@@ -86,7 +86,7 @@ end
func TestSuccessfulListConflictFilesRequestWithAncestor(t *testing.T) {
ctx := testhelper.Context(t)
- _, repo, _, client := SetupConflictsService(ctx, t, true, nil)
+ _, repo, _, client := setupConflictsService(ctx, t, nil)
ourCommitOid := "824be604a34828eb682305f0d963056cfac87b2d"
theirCommitOid := "1450cd639e0bc6721eb02800169e464f212cde06"
@@ -132,7 +132,7 @@ func TestSuccessfulListConflictFilesRequestWithAncestor(t *testing.T) {
func TestListConflictFilesHugeDiff(t *testing.T) {
ctx := testhelper.Context(t)
- cfg, repo, repoPath, client := SetupConflictsService(ctx, t, true, nil)
+ cfg, repo, repoPath, client := setupConflictsService(ctx, t, nil)
ourCommitID := gittest.WriteCommit(t, cfg, repoPath, gittest.WithTreeEntries(
gittest.TreeEntry{Path: "a", Mode: "100644", Content: strings.Repeat("a\n", 128*1024)},
@@ -171,7 +171,7 @@ func TestListConflictFilesHugeDiff(t *testing.T) {
func TestListConflictFilesFailedPrecondition(t *testing.T) {
ctx := testhelper.Context(t)
- _, repo, _, client := SetupConflictsService(ctx, t, true, nil)
+ _, repo, _, client := setupConflictsService(ctx, t, nil)
testCases := []struct {
desc string
@@ -228,7 +228,7 @@ func TestListConflictFilesFailedPrecondition(t *testing.T) {
func TestListConflictFilesAllowTreeConflicts(t *testing.T) {
ctx := testhelper.Context(t)
- _, repo, _, client := SetupConflictsService(ctx, t, true, nil)
+ _, repo, _, client := setupConflictsService(ctx, t, nil)
ourCommitOid := "eb227b3e214624708c474bdab7bde7afc17cefcc"
theirCommitOid := "824be604a34828eb682305f0d963056cfac87b2d"
@@ -320,7 +320,7 @@ end
func TestFailedListConflictFilesRequestDueToValidation(t *testing.T) {
ctx := testhelper.Context(t)
- _, repo, _, client := SetupConflictsService(ctx, t, true, nil)
+ _, repo, _, client := setupConflictsService(ctx, t, nil)
ourCommitOid := "0b4bc9a49b562e85de7cc9e834518ea6828729b9"
theirCommitOid := "bb5206fee213d983da88c47f9cf4cc6caf9c66dc"
diff --git a/internal/gitaly/service/conflicts/resolve_conflicts_test.go b/internal/gitaly/service/conflicts/resolve_conflicts_test.go
index 0cc778069..68840f987 100644
--- a/internal/gitaly/service/conflicts/resolve_conflicts_test.go
+++ b/internal/gitaly/service/conflicts/resolve_conflicts_test.go
@@ -67,7 +67,7 @@ func TestSuccessfulResolveConflictsRequestHelper(t *testing.T) {
ctx := testhelper.Context(t)
hookManager := hook.NewMockManager(t, verifyFuncProxy, verifyFuncProxy, hook.NopUpdate, hook.NopReferenceTransaction)
- cfg, repoProto, repoPath, client := SetupConflictsService(ctx, t, true, hookManager)
+ cfg, repoProto, repoPath, client := setupConflictsService(ctx, t, hookManager)
repo := localrepo.NewTestRepo(t, cfg, repoProto)
@@ -201,7 +201,7 @@ func TestResolveConflictsWithRemoteRepo(t *testing.T) {
ctx := testhelper.Context(t)
hookManager := hook.NewMockManager(t, hook.NopPreReceive, hook.NopPostReceive, hook.NopUpdate, hook.NopReferenceTransaction)
- cfg, sourceRepo, sourceRepoPath, client := SetupConflictsService(ctx, t, true, hookManager)
+ cfg, sourceRepo, sourceRepoPath, client := setupConflictsService(ctx, t, hookManager)
testcfg.BuildGitalySSH(t, cfg)
testcfg.BuildGitalyHooks(t, cfg)
@@ -271,7 +271,7 @@ func TestResolveConflictsWithRemoteRepo(t *testing.T) {
func TestResolveConflictsLineEndings(t *testing.T) {
ctx := testhelper.Context(t)
hookManager := hook.NewMockManager(t, hook.NopPreReceive, hook.NopPostReceive, hook.NopUpdate, hook.NopReferenceTransaction)
- cfg, repo, repoPath, client := SetupConflictsService(ctx, t, true, hookManager)
+ cfg, repo, repoPath, client := setupConflictsService(ctx, t, hookManager)
ctx = testhelper.MergeOutgoingMetadata(ctx, testcfg.GitalyServersMetadataFromCfg(t, cfg))
@@ -391,7 +391,7 @@ func TestResolveConflictsLineEndings(t *testing.T) {
func TestResolveConflictsNonOIDRequests(t *testing.T) {
ctx := testhelper.Context(t)
hookManager := hook.NewMockManager(t, hook.NopPreReceive, hook.NopPostReceive, hook.NopUpdate, hook.NopReferenceTransaction)
- cfg, repoProto, _, client := SetupConflictsService(ctx, t, true, hookManager)
+ cfg, repoProto, _, client := setupConflictsService(ctx, t, hookManager)
ctx = testhelper.MergeOutgoingMetadata(ctx, testcfg.GitalyServersMetadataFromCfg(t, cfg))
@@ -429,7 +429,7 @@ func TestResolveConflictsIdenticalContent(t *testing.T) {
ctx := testhelper.Context(t)
hookManager := hook.NewMockManager(t, hook.NopPreReceive, hook.NopPostReceive, hook.NopUpdate, hook.NopReferenceTransaction)
- cfg, repoProto, repoPath, client := SetupConflictsService(ctx, t, true, hookManager)
+ cfg, repoProto, repoPath, client := setupConflictsService(ctx, t, hookManager)
repo := localrepo.NewTestRepo(t, cfg, repoProto)
@@ -526,7 +526,7 @@ func TestResolveConflictsStableID(t *testing.T) {
ctx := testhelper.Context(t)
hookManager := hook.NewMockManager(t, hook.NopPreReceive, hook.NopPostReceive, hook.NopUpdate, hook.NopReferenceTransaction)
- cfg, repoProto, _, client := SetupConflictsService(ctx, t, true, hookManager)
+ cfg, repoProto, _, client := setupConflictsService(ctx, t, hookManager)
repo := localrepo.NewTestRepo(t, cfg, repoProto)
@@ -594,7 +594,7 @@ func TestResolveConflictsStableID(t *testing.T) {
func TestFailedResolveConflictsRequestDueToResolutionError(t *testing.T) {
ctx := testhelper.Context(t)
hookManager := hook.NewMockManager(t, hook.NopPreReceive, hook.NopPostReceive, hook.NopUpdate, hook.NopReferenceTransaction)
- cfg, repo, _, client := SetupConflictsService(ctx, t, true, hookManager)
+ cfg, repo, _, client := setupConflictsService(ctx, t, hookManager)
mdGS := testcfg.GitalyServersMetadataFromCfg(t, cfg)
mdFF, _ := metadata.FromOutgoingContext(ctx)
@@ -650,7 +650,7 @@ func TestFailedResolveConflictsRequestDueToResolutionError(t *testing.T) {
func TestFailedResolveConflictsRequestDueToValidation(t *testing.T) {
ctx := testhelper.Context(t)
hookManager := hook.NewMockManager(t, hook.NopPreReceive, hook.NopPostReceive, hook.NopUpdate, hook.NopReferenceTransaction)
- cfg, repo, _, client := SetupConflictsService(ctx, t, true, hookManager)
+ cfg, repo, _, client := setupConflictsService(ctx, t, hookManager)
mdGS := testcfg.GitalyServersMetadataFromCfg(t, cfg)
ourCommitOid := "1450cd639e0bc6721eb02800169e464f212cde06"
@@ -816,7 +816,7 @@ func TestResolveConflictsQuarantine(t *testing.T) {
t.Parallel()
ctx := testhelper.Context(t)
- cfg, sourceRepoProto, sourceRepoPath, client := SetupConflictsService(ctx, t, true, nil)
+ cfg, sourceRepoProto, sourceRepoPath, client := setupConflictsService(ctx, t, nil)
testcfg.BuildGitalySSH(t, cfg)
testcfg.BuildGitalyHooks(t, cfg)
diff --git a/internal/gitaly/service/conflicts/testhelper_test.go b/internal/gitaly/service/conflicts/testhelper_test.go
index 853a0581e..60f59c18b 100644
--- a/internal/gitaly/service/conflicts/testhelper_test.go
+++ b/internal/gitaly/service/conflicts/testhelper_test.go
@@ -2,7 +2,6 @@ package conflicts
import (
"context"
- "path/filepath"
"testing"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
@@ -24,7 +23,7 @@ func TestMain(m *testing.M) {
testhelper.Run(m)
}
-func SetupConflictsService(ctx context.Context, t testing.TB, bare bool, hookManager hook.Manager) (config.Cfg, *gitalypb.Repository, string, gitalypb.ConflictsServiceClient) {
+func setupConflictsService(ctx context.Context, t testing.TB, hookManager hook.Manager) (config.Cfg, *gitalypb.Repository, string, gitalypb.ConflictsServiceClient) {
cfg := testcfg.Build(t)
testcfg.BuildGitalyGit2Go(t, cfg)
@@ -39,14 +38,6 @@ func SetupConflictsService(ctx context.Context, t testing.TB, bare bool, hookMan
Seed: gittest.SeedGitLabTest,
})
- if !bare {
- gittest.AddWorktree(t, cfg, repoPath, "worktree")
- repoPath = filepath.Join(repoPath, "worktree")
- // AddWorktree creates a detached worktree. Checkout master here so the
- // branch pointer moves as we later commit.
- gittest.Exec(t, cfg, "-C", repoPath, "checkout", "master")
- }
-
return cfg, repo, repoPath, client
}