diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2022-02-01 17:56:55 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2022-02-01 18:57:48 +0300 |
commit | 8715a9caf3d8e297dacb113502e372d9660e6b44 (patch) | |
tree | f8fbb038c9175ce0fb9be71d7b3709ee8a60b888 | |
parent | 985a1c6a4025f3b98768de5a1eacc1712108160c (diff) |
Propagate test context to setup helpers in commit package
Test setup helpers are currently using a TODO context. This commit
propagates the test context down from the tests to the setup helper.
23 files changed, 154 insertions, 117 deletions
diff --git a/internal/gitaly/service/commit/commit_messages_test.go b/internal/gitaly/service/commit/commit_messages_test.go index e7e1515fe..7e19673cb 100644 --- a/internal/gitaly/service/commit/commit_messages_test.go +++ b/internal/gitaly/service/commit/commit_messages_test.go @@ -15,8 +15,9 @@ import ( func TestSuccessfulGetCommitMessagesRequest(t *testing.T) { t.Parallel() - cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, true) + ctx := testhelper.Context(t) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) message1 := strings.Repeat("a\n", helper.MaxCommitOrTagMessageSize*2) message2 := strings.Repeat("b\n", helper.MaxCommitOrTagMessageSize*2) @@ -56,7 +57,9 @@ func TestSuccessfulGetCommitMessagesRequest(t *testing.T) { func TestFailedGetCommitMessagesRequest(t *testing.T) { t.Parallel() - _, _, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, _, _, client := setupCommitServiceWithRepo(ctx, t, true) testCases := []struct { desc string @@ -75,8 +78,6 @@ func TestFailedGetCommitMessagesRequest(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.desc, func(t *testing.T) { - ctx := testhelper.Context(t) - c, err := client.GetCommitMessages(ctx, testCase.request) require.NoError(t, err) diff --git a/internal/gitaly/service/commit/commit_signatures_test.go b/internal/gitaly/service/commit/commit_signatures_test.go index 67474337d..7481f3633 100644 --- a/internal/gitaly/service/commit/commit_signatures_test.go +++ b/internal/gitaly/service/commit/commit_signatures_test.go @@ -16,14 +16,15 @@ import ( func TestSuccessfulGetCommitSignaturesRequest(t *testing.T) { t.Parallel() - cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) commitData := testhelper.MustReadFile(t, "testdata/dc00eb001f41dfac08192ead79c2377c588b82ee.commit") commit := text.ChompBytes(gittest.ExecOpts(t, cfg, gittest.ExecConfig{Stdin: bytes.NewReader(commitData)}, "-C", repoPath, "hash-object", "-w", "-t", "commit", "--stdin", "--literally", )) require.Equal(t, "dc00eb001f41dfac08192ead79c2377c588b82ee", commit) - ctx := testhelper.Context(t) request := &gitalypb.GetCommitSignaturesRequest{ Repository: repo, @@ -84,7 +85,9 @@ func TestSuccessfulGetCommitSignaturesRequest(t *testing.T) { func TestFailedGetCommitSignaturesRequest(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) testCases := []struct { desc string @@ -119,8 +122,6 @@ func TestFailedGetCommitSignaturesRequest(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.desc, func(t *testing.T) { - ctx := testhelper.Context(t) - c, err := client.GetCommitSignatures(ctx, testCase.request) require.NoError(t, err) diff --git a/internal/gitaly/service/commit/commits_by_message_test.go b/internal/gitaly/service/commit/commits_by_message_test.go index efe261c98..eeab11601 100644 --- a/internal/gitaly/service/commit/commits_by_message_test.go +++ b/internal/gitaly/service/commit/commits_by_message_test.go @@ -36,7 +36,9 @@ var rubyFilesCommit = []*gitalypb.GitCommit{ func TestSuccessfulCommitsByMessageRequest(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) commits := []*gitalypb.GitCommit{ { @@ -139,7 +141,6 @@ func TestSuccessfulCommitsByMessageRequest(t *testing.T) { t.Run(testCase.desc, func(t *testing.T) { request := testCase.request request.Repository = repo - ctx := testhelper.Context(t) c, err := client.CommitsByMessage(ctx, request) require.NoError(t, err) @@ -156,7 +157,9 @@ func TestSuccessfulCommitsByMessageRequest(t *testing.T) { func TestFailedCommitsByMessageRequest(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) invalidRepo := &gitalypb.Repository{StorageName: "fake", RelativePath: "path"} @@ -189,7 +192,6 @@ func TestFailedCommitsByMessageRequest(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.desc, func(t *testing.T) { - ctx := testhelper.Context(t) c, err := client.CommitsByMessage(ctx, testCase.request) require.NoError(t, err) diff --git a/internal/gitaly/service/commit/count_commits_test.go b/internal/gitaly/service/commit/count_commits_test.go index 44c1fb340..1697ea87e 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(t, true) + cfg, repo1, _, client := setupCommitServiceWithRepo(ctx, t, true) repo2, repo2Path := gittest.CreateRepository(ctx, t, cfg) @@ -146,6 +146,7 @@ func TestSuccessfulCountCommitsRequest(t *testing.T) { if testCase.path != nil { request.Path = testCase.path } + response, err := client.CountCommits(ctx, request) require.NoError(t, err) require.Equal(t, response.Count, testCase.count) @@ -155,7 +156,9 @@ func TestSuccessfulCountCommitsRequest(t *testing.T) { func TestFailedCountCommitsRequestDueToValidationError(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) revision := []byte("d42783470dc29fde2cf459eb3199ee1d7e3f3a72") @@ -168,7 +171,6 @@ func TestFailedCountCommitsRequestDueToValidationError(t *testing.T) { for _, rpcRequest := range rpcRequests { t.Run(fmt.Sprintf("%v", rpcRequest), func(t *testing.T) { - ctx := testhelper.Context(t) _, err := client.CountCommits(ctx, rpcRequest) testhelper.RequireGrpcCode(t, err, codes.InvalidArgument) }) diff --git a/internal/gitaly/service/commit/count_diverging_commits_test.go b/internal/gitaly/service/commit/count_diverging_commits_test.go index 62ee2b48d..b90fa15bb 100644 --- a/internal/gitaly/service/commit/count_diverging_commits_test.go +++ b/internal/gitaly/service/commit/count_diverging_commits_test.go @@ -40,7 +40,7 @@ func TestSuccessfulCountDivergentCommitsRequest(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, client := setupCommitService(t) + cfg, client := setupCommitService(ctx, t) testRepo := createRepoWithDivergentBranches(ctx, t, cfg, 3, 3, "left", "right") @@ -114,7 +114,7 @@ func TestSuccessfulCountDivergentCommitsRequestWithMaxCount(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, client := setupCommitService(t) + cfg, client := setupCommitService(ctx, t) testRepo := createRepoWithDivergentBranches(ctx, t, cfg, 4, 4, "left", "right") @@ -157,7 +157,9 @@ func TestSuccessfulCountDivergentCommitsRequestWithMaxCount(t *testing.T) { func TestFailedCountDivergentCommitsRequestDueToValidationError(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) revision := []byte("d42783470dc29fde2cf459eb3199ee1d7e3f3a72") @@ -170,7 +172,6 @@ func TestFailedCountDivergentCommitsRequestDueToValidationError(t *testing.T) { for _, rpcRequest := range rpcRequests { t.Run(fmt.Sprintf("%v", rpcRequest), func(t *testing.T) { - ctx := testhelper.Context(t) _, err := client.CountDivergingCommits(ctx, rpcRequest) testhelper.RequireGrpcCode(t, err, codes.InvalidArgument) }) 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 59fa8d7e7..785a54161 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(t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) 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 08f861085..13e4cb379 100644 --- a/internal/gitaly/service/commit/find_all_commits_test.go +++ b/internal/gitaly/service/commit/find_all_commits_test.go @@ -15,8 +15,8 @@ import ( func TestSuccessfulFindAllCommitsRequest(t *testing.T) { t.Parallel() - cfg, repoProto, _, client := setupCommitServiceWithRepo(t, true) ctx := testhelper.Context(t) + cfg, repoProto, _, client := setupCommitServiceWithRepo(ctx, t, true) repo := localrepo.NewTestRepo(t, cfg, repoProto) refs, err := repo.GetReferences(ctx, "refs/") @@ -157,7 +157,9 @@ func TestSuccessfulFindAllCommitsRequest(t *testing.T) { func TestFailedFindAllCommitsRequest(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) invalidRepo := &gitalypb.Repository{StorageName: "fake", RelativePath: "path"} @@ -188,7 +190,6 @@ func TestFailedFindAllCommitsRequest(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.desc, func(t *testing.T) { - ctx := testhelper.Context(t) c, err := client.FindAllCommits(ctx, testCase.request) require.NoError(t, err) diff --git a/internal/gitaly/service/commit/find_commit_test.go b/internal/gitaly/service/commit/find_commit_test.go index 5799770af..8a57d56e0 100644 --- a/internal/gitaly/service/commit/find_commit_test.go +++ b/internal/gitaly/service/commit/find_commit_test.go @@ -22,10 +22,10 @@ func TestSuccessfulFindCommitRequest(t *testing.T) { t.Parallel() windows1251Message := testhelper.MustReadFile(t, "testdata/commit-c809470461118b7bcab850f6e9a7ca97ac42f8ea-message.txt") - cfg, repoProto, repoPath, client := setupCommitServiceWithRepo(t, true) + ctx := testhelper.Context(t) + cfg, repoProto, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) repo := localrepo.NewTestRepo(t, cfg, repoProto) - ctx := testhelper.Context(t) bigMessage := "An empty commit with REALLY BIG message\n\n" + strings.Repeat("MOAR!\n", 20*1024) bigCommitID := gittest.WriteCommit(t, cfg, repoPath, @@ -253,7 +253,9 @@ func TestSuccessfulFindCommitRequest(t *testing.T) { func TestFailedFindCommitRequest(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) invalidRepo := &gitalypb.Repository{StorageName: "fake", RelativePath: "path"} @@ -267,7 +269,6 @@ func TestFailedFindCommitRequest(t *testing.T) { {repo: repo, revision: []byte("-master"), description: "Invalid revision"}, {repo: repo, revision: []byte("mas:ter"), description: "Invalid revision"}, } - ctx := testhelper.Context(t) for _, testCase := range testCases { t.Run(testCase.description, func(t *testing.T) { @@ -293,7 +294,7 @@ func BenchmarkFindCommitWithCache(b *testing.B) { func benchmarkFindCommit(withCache bool, b *testing.B) { ctx := testhelper.Context(b) - cfg, repo, _, client := setupCommitServiceWithRepo(b, false) + cfg, repo, _, client := setupCommitServiceWithRepo(ctx, b, false) // get a list of revisions gitCmdFactory := gittest.NewCommandFactory(b, cfg) @@ -331,7 +332,7 @@ func TestFindCommitWithCache(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, repo, _, client := setupCommitServiceWithRepo(t, true) + cfg, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) // 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 cbf5e91dd..0252e9c45 100644 --- a/internal/gitaly/service/commit/find_commits_test.go +++ b/internal/gitaly/service/commit/find_commits_test.go @@ -20,7 +20,8 @@ func TestFindCommitsFields(t *testing.T) { t.Parallel() windows1251Message := testhelper.MustReadFile(t, "testdata/commit-c809470461118b7bcab850f6e9a7ca97ac42f8ea-message.txt") - _, repo, _, client := setupCommitServiceWithRepo(t, true) + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) testCases := []struct { id string @@ -155,7 +156,6 @@ func TestFindCommitsFields(t *testing.T) { Trailers: tc.trailers, Limit: 1, } - ctx := testhelper.Context(t) stream, err := client.FindCommits(ctx, request) require.NoError(t, err) @@ -175,7 +175,9 @@ func TestFindCommitsFields(t *testing.T) { func TestSuccessfulFindCommitsRequest(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) testCases := []struct { desc string @@ -403,8 +405,6 @@ func TestSuccessfulFindCommitsRequest(t *testing.T) { for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { - ctx := testhelper.Context(t) - stream, err := client.FindCommits(ctx, tc.request) require.NoError(t, err) @@ -433,7 +433,9 @@ func TestSuccessfulFindCommitsRequest(t *testing.T) { func TestSuccessfulFindCommitsRequestWithAltGitObjectDirs(t *testing.T) { t.Parallel() - cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) altObjectsDir := "./alt-objects" commitID := gittest.WriteCommit(t, cfg, repoPath, @@ -465,7 +467,6 @@ func TestSuccessfulFindCommitsRequestWithAltGitObjectDirs(t *testing.T) { Revision: []byte(commitID.String()), Limit: 1, } - ctx := testhelper.Context(t) c, err := client.FindCommits(ctx, request) require.NoError(t, err) @@ -479,7 +480,9 @@ func TestSuccessfulFindCommitsRequestWithAltGitObjectDirs(t *testing.T) { func TestSuccessfulFindCommitsRequestWithAmbiguousRef(t *testing.T) { t.Parallel() - cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, false) + + ctx := testhelper.Context(t) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, false) // 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 @@ -494,7 +497,6 @@ func TestSuccessfulFindCommitsRequestWithAmbiguousRef(t *testing.T) { Revision: []byte(branchName), Limit: 1, } - ctx := testhelper.Context(t) c, err := client.FindCommits(ctx, request) require.NoError(t, err) @@ -506,7 +508,9 @@ func TestSuccessfulFindCommitsRequestWithAmbiguousRef(t *testing.T) { func TestFailureFindCommitsRequest(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) testCases := []struct { desc string @@ -534,8 +538,6 @@ func TestFailureFindCommitsRequest(t *testing.T) { for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { - ctx := testhelper.Context(t) - stream, err := client.FindCommits(ctx, tc.request) require.NoError(t, err) @@ -550,7 +552,9 @@ func TestFailureFindCommitsRequest(t *testing.T) { func TestFindCommitsRequestWithFollowAndOffset(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) request := &gitalypb.FindCommitsRequest{ Repository: repo, @@ -558,7 +562,6 @@ func TestFindCommitsRequestWithFollowAndOffset(t *testing.T) { Paths: [][]byte{[]byte("CHANGELOG")}, Limit: 100, } - ctx := testhelper.Context(t) allCommits := getCommits(ctx, t, request, client) totalCommits := len(allCommits) @@ -576,8 +579,9 @@ func TestFindCommitsRequestWithFollowAndOffset(t *testing.T) { func TestFindCommitsWithExceedingOffset(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) 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 0e5a39b65..f850af9dd 100644 --- a/internal/gitaly/service/commit/isancestor_test.go +++ b/internal/gitaly/service/commit/isancestor_test.go @@ -17,7 +17,9 @@ import ( func TestCommitIsAncestorFailure(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) queries := []struct { Request *gitalypb.CommitIsAncestorRequest @@ -64,7 +66,6 @@ func TestCommitIsAncestorFailure(t *testing.T) { for _, v := range queries { t.Run(fmt.Sprintf("%v", v.Request), func(t *testing.T) { - ctx := testhelper.Context(t) if _, err := client.CommitIsAncestor(ctx, v.Request); err == nil { t.Error("Expected to throw an error") } else if helper.GrpcCode(err) != v.ErrorCode { @@ -76,7 +77,9 @@ func TestCommitIsAncestorFailure(t *testing.T) { func TestCommitIsAncestorSuccess(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) queries := []struct { Request *gitalypb.CommitIsAncestorRequest @@ -150,7 +153,6 @@ func TestCommitIsAncestorSuccess(t *testing.T) { for _, v := range queries { t.Run(fmt.Sprintf("%v", v.Request), func(t *testing.T) { - ctx := testhelper.Context(t) c, err := client.CommitIsAncestor(ctx, v.Request) require.NoError(t, err) @@ -162,7 +164,9 @@ func TestCommitIsAncestorSuccess(t *testing.T) { func TestSuccessfulIsAncestorRequestWithAltGitObjectDirs(t *testing.T) { t.Parallel() - cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) parentCommitID := git.ObjectID(text.ChompBytes(gittest.Exec(t, cfg, "-C", repoPath, "rev-parse", "--verify", "HEAD"))) @@ -197,7 +201,6 @@ func TestSuccessfulIsAncestorRequestWithAltGitObjectDirs(t *testing.T) { AncestorId: string(parentCommitID), ChildId: commitID.String(), } - ctx := testhelper.Context(t) response, err := client.CommitIsAncestor(ctx, request) require.NoError(t, err) diff --git a/internal/gitaly/service/commit/languages_test.go b/internal/gitaly/service/commit/languages_test.go index 546c300cd..82a676cd2 100644 --- a/internal/gitaly/service/commit/languages_test.go +++ b/internal/gitaly/service/commit/languages_test.go @@ -54,13 +54,14 @@ func TestLanguages(t *testing.T) { func TestFileCountIsZeroWhenFeatureIsDisabled(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) request := &gitalypb.CommitLanguagesRequest{ Repository: repo, Revision: []byte("cb19058ecc02d01f8e4290b7e79cafd16a8839b6"), } - ctx := testhelper.Context(t) resp, err := client.CommitLanguages(ctx, request) require.NoError(t, err) @@ -84,12 +85,13 @@ func requireLanguageEqual(t *testing.T, expected, actual *gitalypb.CommitLanguag func TestLanguagesEmptyRevision(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) request := &gitalypb.CommitLanguagesRequest{ Repository: repo, } - ctx := testhelper.Context(t) resp, err := client.CommitLanguages(ctx, request) require.NoError(t, err) @@ -106,8 +108,9 @@ func TestLanguagesEmptyRevision(t *testing.T) { func TestInvalidCommitLanguagesRequestRevision(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) _, err := client.CommitLanguages(ctx, &gitalypb.CommitLanguagesRequest{ Repository: repo, @@ -118,8 +121,9 @@ func TestInvalidCommitLanguagesRequestRevision(t *testing.T) { func TestAmbiguousRefCommitLanguagesRequestRevision(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) // 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 6f4bfbab0..fa040279c 100644 --- a/internal/gitaly/service/commit/last_commit_for_path_test.go +++ b/internal/gitaly/service/commit/last_commit_for_path_test.go @@ -13,7 +13,9 @@ import ( func TestSuccessfulLastCommitForPathRequest(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) commit := testhelper.GitLabTestCommit("570e7b2abdd848b95f2f578043fc23bd6f6fd24d") @@ -60,7 +62,6 @@ func TestSuccessfulLastCommitForPathRequest(t *testing.T) { Revision: []byte(testCase.revision), Path: testCase.path, } - ctx := testhelper.Context(t) response, err := client.LastCommitForPath(ctx, request) require.NoError(t, err) @@ -72,7 +73,9 @@ func TestSuccessfulLastCommitForPathRequest(t *testing.T) { func TestFailedLastCommitForPathRequest(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) invalidRepo := &gitalypb.Repository{StorageName: "fake", RelativePath: "path"} @@ -107,7 +110,6 @@ func TestFailedLastCommitForPathRequest(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.desc, func(t *testing.T) { - ctx := testhelper.Context(t) _, err := client.LastCommitForPath(ctx, testCase.request) testhelper.RequireGrpcCode(t, err, testCase.code) }) @@ -116,7 +118,9 @@ func TestFailedLastCommitForPathRequest(t *testing.T) { func TestSuccessfulLastCommitWithGlobCharacters(t *testing.T) { t.Parallel() - cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) // This is an arbitrary blob known to exist in the test repository const blobID = "c60514b6d3d6bf4bec1030f70026e34dfbd69ad5" @@ -134,7 +138,6 @@ func TestSuccessfulLastCommitWithGlobCharacters(t *testing.T) { Path: []byte(path), LiteralPathspec: true, } - ctx := testhelper.Context(t) response, err := client.LastCommitForPath(ctx, request) require.NoError(t, err) require.NotNil(t, response.GetCommit()) diff --git a/internal/gitaly/service/commit/list_all_commits_test.go b/internal/gitaly/service/commit/list_all_commits_test.go index a11705a98..e6ceb9463 100644 --- a/internal/gitaly/service/commit/list_all_commits_test.go +++ b/internal/gitaly/service/commit/list_all_commits_test.go @@ -34,7 +34,7 @@ func TestListAllCommits(t *testing.T) { ctx := testhelper.Context(t) t.Run("empty repo", func(t *testing.T) { - cfg, client := setupCommitService(t) + cfg, client := setupCommitService(ctx, t) repo, _ := gittest.CreateRepository(ctx, t, cfg) @@ -47,7 +47,7 @@ func TestListAllCommits(t *testing.T) { }) t.Run("normal repo", func(t *testing.T) { - _, repo, _, client := setupCommitServiceWithRepo(t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) 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(t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) 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(t, true) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) 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(b, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, b, true) 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 efa4924e2..100f2eb22 100644 --- a/internal/gitaly/service/commit/list_commits_by_oid_test.go +++ b/internal/gitaly/service/commit/list_commits_by_oid_test.go @@ -10,7 +10,9 @@ import ( func TestSuccessfulListCommitsByOidRequest(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) commits := []*gitalypb.GitCommit{ { @@ -88,7 +90,6 @@ func TestSuccessfulListCommitsByOidRequest(t *testing.T) { t.Run(testCase.desc, func(t *testing.T) { request := testCase.request request.Repository = repo - ctx := testhelper.Context(t) c, err := client.ListCommitsByOid(ctx, request) require.NoError(t, err) @@ -151,13 +152,14 @@ var masterCommitids = []string{ func TestSuccessfulListCommitsByOidLargeRequest(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) req := &gitalypb.ListCommitsByOidRequest{ Oid: masterCommitids, Repository: repo, } - ctx := testhelper.Context(t) c, err := client.ListCommitsByOid(ctx, req) require.NoError(t, err) 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 8f3b25ca3..0fce1f01d 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 @@ -11,7 +11,9 @@ import ( func TestSuccessfulListCommitsByRefNameRequest(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) testCases := []struct { desc string @@ -127,7 +129,6 @@ func TestSuccessfulListCommitsByRefNameRequest(t *testing.T) { t.Run(testCase.desc, func(t *testing.T) { request := testCase.request request.Repository = repo - ctx := testhelper.Context(t) c, err := client.ListCommitsByRefName(ctx, request) require.NoError(t, err) @@ -167,7 +168,8 @@ func TestSuccessfulListCommitsByRefNameLargeRequest(t *testing.T) { "8a2a6eb295bb170b34c24c76c49ed0e9b2eaf34b": "refs/tags/v1.1.0", } - _, repo, _, client := setupCommitServiceWithRepo(t, true) + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) refNames := [][]byte{} for _, refName := range repositoryRefNames { @@ -177,7 +179,6 @@ func TestSuccessfulListCommitsByRefNameLargeRequest(t *testing.T) { RefNames: refNames, Repository: repo, } - ctx := testhelper.Context(t) c, err := client.ListCommitsByRefName(ctx, req) require.NoError(t, err) diff --git a/internal/gitaly/service/commit/list_commits_test.go b/internal/gitaly/service/commit/list_commits_test.go index d1ca28ca9..75a59a6ac 100644 --- a/internal/gitaly/service/commit/list_commits_test.go +++ b/internal/gitaly/service/commit/list_commits_test.go @@ -13,7 +13,8 @@ import ( ) func TestListCommits(t *testing.T) { - _, repo, _, client := setupCommitServiceWithRepo(t, true) + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) for _, tc := range []struct { desc string @@ -257,8 +258,6 @@ func TestListCommits(t *testing.T) { }, } { t.Run(tc.desc, func(t *testing.T) { - ctx := testhelper.Context(t) - stream, err := client.ListCommits(ctx, tc.request) require.NoError(t, err) diff --git a/internal/gitaly/service/commit/list_files_test.go b/internal/gitaly/service/commit/list_files_test.go index 1011a3f8f..cb4857b4d 100644 --- a/internal/gitaly/service/commit/list_files_test.go +++ b/internal/gitaly/service/commit/list_files_test.go @@ -37,7 +37,8 @@ var defaultFiles = [][]byte{ } func TestListFiles_success(t *testing.T) { - cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, true) + ctx := testhelper.Context(t) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) gittest.Exec(t, cfg, "-C", repoPath, "symbolic-ref", "HEAD", "refs/heads/test-do-not-touch") @@ -101,7 +102,6 @@ func TestListFiles_success(t *testing.T) { rpcRequest := gitalypb.ListFilesRequest{ Repository: repo, Revision: []byte(tc.revision), } - ctx := testhelper.Context(t) c, err := client.ListFiles(ctx, &rpcRequest) require.NoError(t, err) @@ -125,7 +125,7 @@ func TestListFiles_unbornBranch(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, _, _, client := setupCommitServiceWithRepo(t, true) + cfg, _, _, client := setupCommitServiceWithRepo(ctx, t, true) repo, _ := gittest.CreateRepository(ctx, t, cfg) tests := []struct { @@ -197,7 +197,9 @@ func TestListFiles_unbornBranch(t *testing.T) { func TestListFiles_failure(t *testing.T) { t.Parallel() - _, _, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, _, _, client := setupCommitServiceWithRepo(ctx, t, true) tests := []struct { desc string @@ -226,7 +228,6 @@ func TestListFiles_failure(t *testing.T) { rpcRequest := gitalypb.ListFilesRequest{ Repository: tc.repo, Revision: []byte("master"), } - ctx := testhelper.Context(t) c, err := client.ListFiles(ctx, &rpcRequest) require.NoError(t, err) @@ -250,8 +251,9 @@ func drainListFilesResponse(c gitalypb.CommitService_ListFilesClient) error { func TestListFiles_invalidRevision(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) 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 fc8741187..f848e48e6 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 @@ -24,7 +24,9 @@ type commitInfo struct { func TestSuccessfulListLastCommitsForTreeRequest(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) testCases := []struct { desc string @@ -181,7 +183,6 @@ func TestSuccessfulListLastCommitsForTreeRequest(t *testing.T) { Limit: testCase.limit, Offset: testCase.offset, } - ctx := testhelper.Context(t) stream, err := client.ListLastCommitsForTree(ctx, request) require.NoError(t, err) @@ -212,7 +213,9 @@ func TestSuccessfulListLastCommitsForTreeRequest(t *testing.T) { func TestFailedListLastCommitsForTreeRequest(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) invalidRepo := &gitalypb.Repository{StorageName: "broken", RelativePath: "path"} @@ -307,8 +310,6 @@ func TestFailedListLastCommitsForTreeRequest(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.desc, func(t *testing.T) { - ctx := testhelper.Context(t) - stream, err := client.ListLastCommitsForTree(ctx, testCase.request) require.NoError(t, err) @@ -320,8 +321,9 @@ func TestFailedListLastCommitsForTreeRequest(t *testing.T) { func TestNonUtf8ListLastCommitsForTreeRequest(t *testing.T) { t.Parallel() - cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, true) + ctx := testhelper.Context(t) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) // This is an arbitrary blob known to exist in the test repository const blobID = "c60514b6d3d6bf4bec1030f70026e34dfbd69ad5" @@ -350,7 +352,9 @@ func TestNonUtf8ListLastCommitsForTreeRequest(t *testing.T) { func TestSuccessfulListLastCommitsForTreeRequestWithGlobCharacters(t *testing.T) { t.Parallel() - cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, false) + + ctx := testhelper.Context(t) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, false) path := ":wq" err := os.Mkdir(filepath.Join(repoPath, path), 0o755) @@ -368,7 +372,6 @@ func TestSuccessfulListLastCommitsForTreeRequestWithGlobCharacters(t *testing.T) Limit: 100, Offset: 0, } - ctx := testhelper.Context(t) stream, err := client.ListLastCommitsForTree(ctx, request) require.NoError(t, err) diff --git a/internal/gitaly/service/commit/raw_blame_test.go b/internal/gitaly/service/commit/raw_blame_test.go index 405ad1c7d..5de17dd91 100644 --- a/internal/gitaly/service/commit/raw_blame_test.go +++ b/internal/gitaly/service/commit/raw_blame_test.go @@ -14,7 +14,9 @@ import ( func TestSuccessfulRawBlameRequest(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) testCases := []struct { revision, path, data []byte @@ -43,7 +45,6 @@ func TestSuccessfulRawBlameRequest(t *testing.T) { Revision: testCase.revision, Path: testCase.path, } - ctx := testhelper.Context(t) c, err := client.RawBlame(ctx, request) require.NoError(t, err) @@ -62,7 +63,9 @@ func TestSuccessfulRawBlameRequest(t *testing.T) { func TestFailedRawBlameRequest(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) invalidRepo := &gitalypb.Repository{StorageName: "fake", RelativePath: "path"} @@ -109,7 +112,6 @@ func TestFailedRawBlameRequest(t *testing.T) { Revision: testCase.revision, Path: testCase.path, } - ctx := testhelper.Context(t) c, err := client.RawBlame(ctx, &request) require.NoError(t, err) diff --git a/internal/gitaly/service/commit/stats_test.go b/internal/gitaly/service/commit/stats_test.go index 242035c82..2305eb13d 100644 --- a/internal/gitaly/service/commit/stats_test.go +++ b/internal/gitaly/service/commit/stats_test.go @@ -12,8 +12,9 @@ import ( func TestCommitStatsSuccess(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) tests := []struct { desc string @@ -75,8 +76,9 @@ func TestCommitStatsSuccess(t *testing.T) { func TestCommitStatsFailure(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) tests := []struct { desc string diff --git a/internal/gitaly/service/commit/testhelper_test.go b/internal/gitaly/service/commit/testhelper_test.go index 09e7c1ff7..ad1e1b41e 100644 --- a/internal/gitaly/service/commit/testhelper_test.go +++ b/internal/gitaly/service/commit/testhelper_test.go @@ -26,8 +26,8 @@ func TestMain(m *testing.M) { } // setupCommitService makes a basic configuration and starts the service with the client. -func setupCommitService(t testing.TB) (config.Cfg, gitalypb.CommitServiceClient) { - cfg, _, _, client := setupCommitServiceCreateRepo(t, func(tb testing.TB, cfg config.Cfg) (*gitalypb.Repository, string) { +func setupCommitService(ctx context.Context, t testing.TB) (config.Cfg, gitalypb.CommitServiceClient) { + cfg, _, _, client := setupCommitServiceCreateRepo(ctx, t, func(ctx context.Context, tb testing.TB, cfg config.Cfg) (*gitalypb.Repository, string) { return nil, "" }) return cfg, client @@ -35,10 +35,10 @@ func setupCommitService(t testing.TB) (config.Cfg, gitalypb.CommitServiceClient) // setupCommitServiceWithRepo makes a basic configuration, creates a test repository and starts the service with the client. func setupCommitServiceWithRepo( - t testing.TB, bare bool, + ctx context.Context, t testing.TB, bare bool, ) (config.Cfg, *gitalypb.Repository, string, gitalypb.CommitServiceClient) { - return setupCommitServiceCreateRepo(t, func(tb testing.TB, cfg config.Cfg) (*gitalypb.Repository, string) { - repo, repoPath := gittest.CreateRepository(context.TODO(), tb, cfg, gittest.CreateRepositoryConfig{ + 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, }) @@ -53,15 +53,16 @@ func setupCommitServiceWithRepo( } func setupCommitServiceCreateRepo( + ctx context.Context, t testing.TB, - createRepo func(testing.TB, config.Cfg) (*gitalypb.Repository, string), + createRepo func(context.Context, testing.TB, config.Cfg) (*gitalypb.Repository, string), ) (config.Cfg, *gitalypb.Repository, string, gitalypb.CommitServiceClient) { cfg := testcfg.Build(t) cfg.SocketPath = startTestServices(t, cfg) client := newCommitServiceClient(t, cfg.SocketPath) - repo, repoPath := createRepo(t, cfg) + repo, repoPath := createRepo(ctx, t, cfg) return cfg, repo, repoPath, client } diff --git a/internal/gitaly/service/commit/tree_entries_test.go b/internal/gitaly/service/commit/tree_entries_test.go index 6ac2e00b4..c61e9ca50 100644 --- a/internal/gitaly/service/commit/tree_entries_test.go +++ b/internal/gitaly/service/commit/tree_entries_test.go @@ -20,8 +20,8 @@ import ( func TestGetTreeEntries_curlyBraces(t *testing.T) { t.Parallel() - cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, false) ctx := testhelper.Context(t) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, false) normalFolderName := "issue-46261/folder" curlyFolderName := "issue-46261/{{curly}}" @@ -84,7 +84,7 @@ func TestGetTreeEntries_successful(t *testing.T) { commitID := "d25b6d94034242f3930dfcfeb6d8d9aac3583992" rootOid := "21bdc8af908562ae485ed46d71dd5426c08b084a" - _, repo, _, client := setupCommitServiceWithRepo(t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) rootEntries := []*gitalypb.TreeEntry{ { @@ -474,7 +474,7 @@ func TestGetTreeEntries_unsuccessful(t *testing.T) { commitID := "d25b6d94034242f3930dfcfeb6d8d9aac3583992" - _, repo, _, client := setupCommitServiceWithRepo(t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) testCases := []struct { description string @@ -521,7 +521,7 @@ func TestGetTreeEntries_deepFlatpath(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, false) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, false) folderName := "1/2/3/4/5/6/7/8/9/10/11/12" require.GreaterOrEqual(t, strings.Count(strings.Trim(folderName, "/"), "/"), defaultFlatTreeRecursion, "sanity check: construct folder deeper than default recursion value") @@ -567,7 +567,7 @@ func TestGetTreeEntries_file(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, true) + cfg, repo, repoPath, client := setupCommitServiceWithRepo(ctx, t, true) commitID := gittest.WriteCommit(t, cfg, repoPath, gittest.WithTreeEntries(gittest.TreeEntry{ @@ -597,7 +597,7 @@ func TestGetTreeEntries_validation(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - _, repo, _, client := setupCommitServiceWithRepo(t, true) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) revision := []byte("d42783470dc29fde2cf459eb3199ee1d7e3f3a72") path := []byte("a/b/c") @@ -622,8 +622,8 @@ func TestGetTreeEntries_validation(t *testing.T) { } func BenchmarkGetTreeEntries(b *testing.B) { - cfg, client := setupCommitService(b) ctx := testhelper.Context(b) + cfg, client := setupCommitService(ctx, b) repo, _ := gittest.CloneRepo(b, cfg, cfg.Storages[0], gittest.CloneRepoOpts{ SourceRepo: "benchmark.git", diff --git a/internal/gitaly/service/commit/tree_entry_test.go b/internal/gitaly/service/commit/tree_entry_test.go index 19c6119c3..08ef53116 100644 --- a/internal/gitaly/service/commit/tree_entry_test.go +++ b/internal/gitaly/service/commit/tree_entry_test.go @@ -22,7 +22,9 @@ type treeEntry struct { func TestSuccessfulTreeEntry(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) testCases := []struct { revision []byte @@ -139,7 +141,6 @@ func TestSuccessfulTreeEntry(t *testing.T) { Limit: testCase.limit, MaxSize: testCase.maxSize, } - ctx := testhelper.Context(t) c, err := client.TreeEntry(ctx, request) require.NoError(t, err) @@ -150,7 +151,9 @@ func TestSuccessfulTreeEntry(t *testing.T) { func TestFailedTreeEntry(t *testing.T) { t.Parallel() - _, repo, _, client := setupCommitServiceWithRepo(t, true) + + ctx := testhelper.Context(t) + _, repo, _, client := setupCommitServiceWithRepo(ctx, t, true) revision := []byte("d42783470dc29fde2cf459eb3199ee1d7e3f3a72") path := []byte("a/b/c") @@ -219,7 +222,6 @@ func TestFailedTreeEntry(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - ctx := testhelper.Context(t) c, err := client.TreeEntry(ctx, testCase.req) require.NoError(t, err) |