diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-05-03 15:10:21 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-05-04 13:22:55 +0300 |
commit | 267b1005c59483c1541da7358c9d413ddd3963ff (patch) | |
tree | 4665361a3bb8ac933b097dbe81ff8a1e5bb8348b | |
parent | 1f55c614eef6f4f5b8c9081c58dd2d008134ebfa (diff) |
commit: Drop ability to create test commit service with 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.
23 files changed, 63 insertions, 71 deletions
diff --git a/internal/gitaly/service/commit/commit_messages_test.go b/internal/gitaly/service/commit/commit_messages_test.go index 7e19673cb..43d162ecf 100644 --- a/internal/gitaly/service/commit/commit_messages_test.go +++ b/internal/gitaly/service/commit/commit_messages_test.go @@ -17,7 +17,7 @@ func TestSuccessfulGetCommitMessagesRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t) message1 := strings.Repeat("a\n", helper.MaxCommitOrTagMessageSize*2) message2 := strings.Repeat("b\n", helper.MaxCommitOrTagMessageSize*2) @@ -59,7 +59,7 @@ func TestFailedGetCommitMessagesRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, _, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, _, _, client := setupCommitServiceWithRepo(ctx, t) testCases := []struct { desc string diff --git a/internal/gitaly/service/commit/commit_signatures_test.go b/internal/gitaly/service/commit/commit_signatures_test.go index 7481f3633..90fa72c7e 100644 --- a/internal/gitaly/service/commit/commit_signatures_test.go +++ b/internal/gitaly/service/commit/commit_signatures_test.go @@ -18,7 +18,7 @@ func TestSuccessfulGetCommitSignaturesRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t) commitData := testhelper.MustReadFile(t, "testdata/dc00eb001f41dfac08192ead79c2377c588b82ee.commit") commit := text.ChompBytes(gittest.ExecOpts(t, cfg, gittest.ExecConfig{Stdin: bytes.NewReader(commitData)}, @@ -87,7 +87,7 @@ func TestFailedGetCommitSignaturesRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) testCases := []struct { desc string diff --git a/internal/gitaly/service/commit/commits_by_message_test.go b/internal/gitaly/service/commit/commits_by_message_test.go index eeab11601..1974a342a 100644 --- a/internal/gitaly/service/commit/commits_by_message_test.go +++ b/internal/gitaly/service/commit/commits_by_message_test.go @@ -38,7 +38,7 @@ func TestSuccessfulCommitsByMessageRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) commits := []*gitalypb.GitCommit{ { @@ -159,7 +159,7 @@ func TestFailedCommitsByMessageRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) invalidRepo := &gitalypb.Repository{StorageName: "fake", RelativePath: "path"} diff --git a/internal/gitaly/service/commit/count_commits_test.go b/internal/gitaly/service/commit/count_commits_test.go index 1697ea87e..085a83090 100644 --- a/internal/gitaly/service/commit/count_commits_test.go +++ b/internal/gitaly/service/commit/count_commits_test.go @@ -17,7 +17,7 @@ func TestSuccessfulCountCommitsRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, repo1, _, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, repo1, _, client := setupCommitServiceWithRepo(ctx, t) repo2, repo2Path := gittest.CreateRepository(ctx, t, cfg) @@ -158,7 +158,7 @@ func TestFailedCountCommitsRequestDueToValidationError(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) revision := []byte("d42783470dc29fde2cf459eb3199ee1d7e3f3a72") diff --git a/internal/gitaly/service/commit/count_diverging_commits_test.go b/internal/gitaly/service/commit/count_diverging_commits_test.go index b90fa15bb..e882c0ec5 100644 --- a/internal/gitaly/service/commit/count_diverging_commits_test.go +++ b/internal/gitaly/service/commit/count_diverging_commits_test.go @@ -159,7 +159,7 @@ func TestFailedCountDivergentCommitsRequestDueToValidationError(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) revision := []byte("d42783470dc29fde2cf459eb3199ee1d7e3f3a72") diff --git a/internal/gitaly/service/commit/filter_shas_with_signatures_test.go b/internal/gitaly/service/commit/filter_shas_with_signatures_test.go index 785a54161..100b2a4da 100644 --- a/internal/gitaly/service/commit/filter_shas_with_signatures_test.go +++ b/internal/gitaly/service/commit/filter_shas_with_signatures_test.go @@ -13,7 +13,7 @@ func TestFilterShasWithSignaturesSuccessful(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) type testCase struct { desc string diff --git a/internal/gitaly/service/commit/find_all_commits_test.go b/internal/gitaly/service/commit/find_all_commits_test.go index 13e4cb379..8ce96855e 100644 --- a/internal/gitaly/service/commit/find_all_commits_test.go +++ b/internal/gitaly/service/commit/find_all_commits_test.go @@ -16,7 +16,7 @@ func TestSuccessfulFindAllCommitsRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, repoProto, _, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, repoProto, _, client := setupCommitServiceWithRepo(ctx, t) repo := localrepo.NewTestRepo(t, cfg, repoProto) refs, err := repo.GetReferences(ctx, "refs/") @@ -159,7 +159,7 @@ func TestFailedFindAllCommitsRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) invalidRepo := &gitalypb.Repository{StorageName: "fake", RelativePath: "path"} diff --git a/internal/gitaly/service/commit/find_commit_test.go b/internal/gitaly/service/commit/find_commit_test.go index 0df0846a2..4eaf718ea 100644 --- a/internal/gitaly/service/commit/find_commit_test.go +++ b/internal/gitaly/service/commit/find_commit_test.go @@ -23,7 +23,7 @@ func TestSuccessfulFindCommitRequest(t *testing.T) { windows1251Message := testhelper.MustReadFile(t, "testdata/commit-c809470461118b7bcab850f6e9a7ca97ac42f8ea-message.txt") ctx := testhelper.Context(t) - cfg, repoProto, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, repoProto, repoPath, client := setupCommitServiceWithRepo(ctx, t) repo := localrepo.NewTestRepo(t, cfg, repoProto) @@ -255,7 +255,7 @@ func TestFailedFindCommitRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) invalidRepo := &gitalypb.Repository{StorageName: "fake", RelativePath: "path"} @@ -294,7 +294,7 @@ func BenchmarkFindCommitWithCache(b *testing.B) { func benchmarkFindCommit(withCache bool, b *testing.B) { ctx := testhelper.Context(b) - cfg, repo, _, client := setupCommitServiceWithRepo(ctx, b, true) + cfg, repo, _, client := setupCommitServiceWithRepo(ctx, b) // get a list of revisions gitCmdFactory := gittest.NewCommandFactory(b, cfg) @@ -332,7 +332,7 @@ func TestFindCommitWithCache(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, repo, _, client := setupCommitServiceWithRepo(ctx, t) // get a list of revisions diff --git a/internal/gitaly/service/commit/find_commits_test.go b/internal/gitaly/service/commit/find_commits_test.go index fc4083573..957e21252 100644 --- a/internal/gitaly/service/commit/find_commits_test.go +++ b/internal/gitaly/service/commit/find_commits_test.go @@ -21,7 +21,7 @@ func TestFindCommitsFields(t *testing.T) { windows1251Message := testhelper.MustReadFile(t, "testdata/commit-c809470461118b7bcab850f6e9a7ca97ac42f8ea-message.txt") ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) testCases := []struct { id string @@ -177,7 +177,7 @@ func TestSuccessfulFindCommitsRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) testCases := []struct { desc string @@ -435,7 +435,7 @@ func TestSuccessfulFindCommitsRequestWithAltGitObjectDirs(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t) altObjectsDir := "./alt-objects" commitID := gittest.WriteCommit(t, cfg, repoPath, @@ -482,7 +482,7 @@ func TestSuccessfulFindCommitsRequestWithAmbiguousRef(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t) // These are arbitrary SHAs in the repository. The important part is // that we create a branch using one of them with a different SHA so @@ -510,7 +510,7 @@ func TestFailureFindCommitsRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) testCases := []struct { desc string @@ -554,7 +554,7 @@ func TestFindCommitsRequestWithFollowAndOffset(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) request := &gitalypb.FindCommitsRequest{ Repository: repo, @@ -581,7 +581,7 @@ func TestFindCommitsWithExceedingOffset(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) stream, err := client.FindCommits(ctx, &gitalypb.FindCommitsRequest{ Repository: repo, diff --git a/internal/gitaly/service/commit/isancestor_test.go b/internal/gitaly/service/commit/isancestor_test.go index f850af9dd..355f5256f 100644 --- a/internal/gitaly/service/commit/isancestor_test.go +++ b/internal/gitaly/service/commit/isancestor_test.go @@ -19,7 +19,7 @@ func TestCommitIsAncestorFailure(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) queries := []struct { Request *gitalypb.CommitIsAncestorRequest @@ -79,7 +79,7 @@ func TestCommitIsAncestorSuccess(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) queries := []struct { Request *gitalypb.CommitIsAncestorRequest @@ -166,7 +166,7 @@ func TestSuccessfulIsAncestorRequestWithAltGitObjectDirs(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t) parentCommitID := git.ObjectID(text.ChompBytes(gittest.Exec(t, cfg, "-C", repoPath, "rev-parse", "--verify", "HEAD"))) diff --git a/internal/gitaly/service/commit/languages_test.go b/internal/gitaly/service/commit/languages_test.go index 82a676cd2..7ca44f17f 100644 --- a/internal/gitaly/service/commit/languages_test.go +++ b/internal/gitaly/service/commit/languages_test.go @@ -56,7 +56,7 @@ func TestFileCountIsZeroWhenFeatureIsDisabled(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) request := &gitalypb.CommitLanguagesRequest{ Repository: repo, @@ -87,7 +87,7 @@ func TestLanguagesEmptyRevision(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) request := &gitalypb.CommitLanguagesRequest{ Repository: repo, @@ -110,7 +110,7 @@ func TestInvalidCommitLanguagesRequestRevision(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) _, err := client.CommitLanguages(ctx, &gitalypb.CommitLanguagesRequest{ Repository: repo, @@ -123,7 +123,7 @@ func TestAmbiguousRefCommitLanguagesRequestRevision(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) // gitlab-test repo has both a branch and a tag named 'v1.1.0' // b83d6e391c22777fca1ed3012fce84f633d7fed0 refs/heads/v1.1.0 diff --git a/internal/gitaly/service/commit/last_commit_for_path_test.go b/internal/gitaly/service/commit/last_commit_for_path_test.go index fa040279c..9f61eeb39 100644 --- a/internal/gitaly/service/commit/last_commit_for_path_test.go +++ b/internal/gitaly/service/commit/last_commit_for_path_test.go @@ -15,7 +15,7 @@ func TestSuccessfulLastCommitForPathRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) commit := testhelper.GitLabTestCommit("570e7b2abdd848b95f2f578043fc23bd6f6fd24d") @@ -75,7 +75,7 @@ func TestFailedLastCommitForPathRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) invalidRepo := &gitalypb.Repository{StorageName: "fake", RelativePath: "path"} @@ -120,7 +120,7 @@ func TestSuccessfulLastCommitWithGlobCharacters(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t) // This is an arbitrary blob known to exist in the test repository const blobID = "c60514b6d3d6bf4bec1030f70026e34dfbd69ad5" diff --git a/internal/gitaly/service/commit/list_all_commits_test.go b/internal/gitaly/service/commit/list_all_commits_test.go index e6ceb9463..e568436c3 100644 --- a/internal/gitaly/service/commit/list_all_commits_test.go +++ b/internal/gitaly/service/commit/list_all_commits_test.go @@ -47,7 +47,7 @@ func TestListAllCommits(t *testing.T) { }) t.Run("normal repo", func(t *testing.T) { - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) stream, err := client.ListAllCommits(ctx, &gitalypb.ListAllCommitsRequest{ Repository: repo, @@ -78,7 +78,7 @@ func TestListAllCommits(t *testing.T) { }) t.Run("pagination", func(t *testing.T) { - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) stream, err := client.ListAllCommits(ctx, &gitalypb.ListAllCommitsRequest{ Repository: repo, @@ -95,7 +95,7 @@ func TestListAllCommits(t *testing.T) { }) t.Run("quarantine directory", func(t *testing.T) { - cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t) quarantineDir := filepath.Join("objects", "incoming-123456") require.NoError(t, os.Mkdir(filepath.Join(repoPath, quarantineDir), 0o777)) @@ -150,7 +150,7 @@ func BenchmarkListAllCommits(b *testing.B) { b.StopTimer() ctx := testhelper.Context(b) - _, repo, _, client := setupCommitServiceWithRepo(ctx, b, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, b) b.Run("ListAllCommits", func(b *testing.B) { b.ReportAllocs() diff --git a/internal/gitaly/service/commit/list_commits_by_oid_test.go b/internal/gitaly/service/commit/list_commits_by_oid_test.go index 100f2eb22..b80904cdb 100644 --- a/internal/gitaly/service/commit/list_commits_by_oid_test.go +++ b/internal/gitaly/service/commit/list_commits_by_oid_test.go @@ -12,7 +12,7 @@ func TestSuccessfulListCommitsByOidRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) commits := []*gitalypb.GitCommit{ { @@ -154,7 +154,7 @@ func TestSuccessfulListCommitsByOidLargeRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) req := &gitalypb.ListCommitsByOidRequest{ Oid: masterCommitids, diff --git a/internal/gitaly/service/commit/list_commits_by_ref_name_test.go b/internal/gitaly/service/commit/list_commits_by_ref_name_test.go index 0fce1f01d..cb31f0224 100644 --- a/internal/gitaly/service/commit/list_commits_by_ref_name_test.go +++ b/internal/gitaly/service/commit/list_commits_by_ref_name_test.go @@ -13,7 +13,7 @@ func TestSuccessfulListCommitsByRefNameRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) testCases := []struct { desc string @@ -169,7 +169,7 @@ func TestSuccessfulListCommitsByRefNameLargeRequest(t *testing.T) { } ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) refNames := [][]byte{} for _, refName := range repositoryRefNames { diff --git a/internal/gitaly/service/commit/list_commits_test.go b/internal/gitaly/service/commit/list_commits_test.go index 75a59a6ac..bd2812459 100644 --- a/internal/gitaly/service/commit/list_commits_test.go +++ b/internal/gitaly/service/commit/list_commits_test.go @@ -14,7 +14,7 @@ import ( func TestListCommits(t *testing.T) { ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) for _, tc := range []struct { desc string diff --git a/internal/gitaly/service/commit/list_files_test.go b/internal/gitaly/service/commit/list_files_test.go index cb4857b4d..c6f27d1eb 100644 --- a/internal/gitaly/service/commit/list_files_test.go +++ b/internal/gitaly/service/commit/list_files_test.go @@ -38,7 +38,7 @@ var defaultFiles = [][]byte{ func TestListFiles_success(t *testing.T) { ctx := testhelper.Context(t) - cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t) gittest.Exec(t, cfg, "-C", repoPath, "symbolic-ref", "HEAD", "refs/heads/test-do-not-touch") @@ -125,7 +125,7 @@ func TestListFiles_unbornBranch(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, _, _, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, _, _, client := setupCommitServiceWithRepo(ctx, t) repo, _ := gittest.CreateRepository(ctx, t, cfg) tests := []struct { @@ -199,7 +199,7 @@ func TestListFiles_failure(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, _, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, _, _, client := setupCommitServiceWithRepo(ctx, t) tests := []struct { desc string @@ -253,7 +253,7 @@ func TestListFiles_invalidRevision(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) stream, err := client.ListFiles(ctx, &gitalypb.ListFilesRequest{ Repository: repo, diff --git a/internal/gitaly/service/commit/list_last_commits_for_tree_test.go b/internal/gitaly/service/commit/list_last_commits_for_tree_test.go index 81b681948..f1edfbe09 100644 --- a/internal/gitaly/service/commit/list_last_commits_for_tree_test.go +++ b/internal/gitaly/service/commit/list_last_commits_for_tree_test.go @@ -22,7 +22,7 @@ func TestSuccessfulListLastCommitsForTreeRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) testCases := []struct { desc string @@ -211,7 +211,7 @@ func TestFailedListLastCommitsForTreeRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) invalidRepo := &gitalypb.Repository{StorageName: "broken", RelativePath: "path"} @@ -319,7 +319,7 @@ func TestNonUtf8ListLastCommitsForTreeRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t) // This is an arbitrary blob known to exist in the test repository const blobID = "c60514b6d3d6bf4bec1030f70026e34dfbd69ad5" @@ -350,7 +350,7 @@ func TestSuccessfulListLastCommitsForTreeRequestWithGlobCharacters(t *testing.T) t.Parallel() ctx := testhelper.Context(t) - cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t) commitID := gittest.WriteCommit(t, cfg, repoPath, gittest.WithTreeEntries(gittest.TreeEntry{ Path: ":wq", Mode: "040000", OID: gittest.WriteTree(t, cfg, repoPath, []gittest.TreeEntry{ diff --git a/internal/gitaly/service/commit/raw_blame_test.go b/internal/gitaly/service/commit/raw_blame_test.go index 5de729b04..2313c29f1 100644 --- a/internal/gitaly/service/commit/raw_blame_test.go +++ b/internal/gitaly/service/commit/raw_blame_test.go @@ -16,7 +16,7 @@ func TestSuccessfulRawBlameRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) testCases := []struct { revision, path, data, blameRange []byte @@ -75,7 +75,7 @@ func TestFailedRawBlameRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) invalidRepo := &gitalypb.Repository{StorageName: "fake", RelativePath: "path"} diff --git a/internal/gitaly/service/commit/stats_test.go b/internal/gitaly/service/commit/stats_test.go index 2305eb13d..3237eff4f 100644 --- a/internal/gitaly/service/commit/stats_test.go +++ b/internal/gitaly/service/commit/stats_test.go @@ -14,7 +14,7 @@ func TestCommitStatsSuccess(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) tests := []struct { desc string @@ -78,7 +78,7 @@ func TestCommitStatsFailure(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) tests := []struct { desc string diff --git a/internal/gitaly/service/commit/testhelper_test.go b/internal/gitaly/service/commit/testhelper_test.go index b1b7daf03..8da0178aa 100644 --- a/internal/gitaly/service/commit/testhelper_test.go +++ b/internal/gitaly/service/commit/testhelper_test.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "io" - "path/filepath" "testing" "github.com/stretchr/testify/require" @@ -35,19 +34,12 @@ func setupCommitService(ctx context.Context, t testing.TB) (config.Cfg, gitalypb // setupCommitServiceWithRepo makes a basic configuration, creates a test repository and starts the service with the client. func setupCommitServiceWithRepo( - ctx context.Context, t testing.TB, bare bool, + ctx context.Context, t testing.TB, ) (config.Cfg, *gitalypb.Repository, string, gitalypb.CommitServiceClient) { return setupCommitServiceCreateRepo(ctx, t, func(ctx context.Context, tb testing.TB, cfg config.Cfg) (*gitalypb.Repository, string) { repo, repoPath := gittest.CreateRepository(ctx, tb, cfg, gittest.CreateRepositoryConfig{ Seed: gittest.SeedGitLabTest, }) - - if !bare { - gittest.AddWorktree(t, cfg, repoPath, "worktree") - repoPath = filepath.Join(repoPath, "worktree") - gittest.Exec(t, cfg, "-C", repoPath, "checkout", "master") - } - return repo, repoPath }) } diff --git a/internal/gitaly/service/commit/tree_entries_test.go b/internal/gitaly/service/commit/tree_entries_test.go index 880e6b8c7..eccd6841a 100644 --- a/internal/gitaly/service/commit/tree_entries_test.go +++ b/internal/gitaly/service/commit/tree_entries_test.go @@ -20,7 +20,7 @@ func TestGetTreeEntries_curlyBraces(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t) commitID := gittest.WriteCommit(t, cfg, repoPath, gittest.WithParents(), gittest.WithTreeEntries(gittest.TreeEntry{ Path: "issue-46261", Mode: "040000", OID: gittest.WriteTree(t, cfg, repoPath, []gittest.TreeEntry{ @@ -82,7 +82,7 @@ func TestGetTreeEntries_successful(t *testing.T) { commitID := "d25b6d94034242f3930dfcfeb6d8d9aac3583992" rootOid := "21bdc8af908562ae485ed46d71dd5426c08b084a" - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) rootEntries := []*gitalypb.TreeEntry{ { @@ -485,7 +485,7 @@ func TestGetTreeEntries_unsuccessful(t *testing.T) { commitID := "d25b6d94034242f3930dfcfeb6d8d9aac3583992" - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) testCases := []struct { description string @@ -532,7 +532,7 @@ func TestGetTreeEntries_deepFlatpath(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t) nestingLevel := 12 require.Greater(t, nestingLevel, defaultFlatTreeRecursion, "sanity check: construct folder deeper than default recursion value") @@ -583,7 +583,7 @@ func TestGetTreeEntries_file(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t) commitID := gittest.WriteCommit(t, cfg, repoPath, gittest.WithTreeEntries(gittest.TreeEntry{ @@ -613,7 +613,7 @@ func TestGetTreeEntries_validation(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) revision := []byte("d42783470dc29fde2cf459eb3199ee1d7e3f3a72") path := []byte("a/b/c") diff --git a/internal/gitaly/service/commit/tree_entry_test.go b/internal/gitaly/service/commit/tree_entry_test.go index 08ef53116..706be6173 100644 --- a/internal/gitaly/service/commit/tree_entry_test.go +++ b/internal/gitaly/service/commit/tree_entry_test.go @@ -24,7 +24,7 @@ func TestSuccessfulTreeEntry(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) testCases := []struct { revision []byte @@ -153,7 +153,7 @@ func TestFailedTreeEntry(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t) revision := []byte("d42783470dc29fde2cf459eb3199ee1d7e3f3a72") path := []byte("a/b/c") |