diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-10-10 13:01:02 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-10-14 13:44:54 +0300 |
commit | 1881ab188e2789715ad1307fb1748d6c14e72474 (patch) | |
tree | 5b89a52a44d9e7390208d2f233433dec8629fac4 /internal/gitaly/service/conflicts | |
parent | 7d88809fa9bac82129b76e472f80e917eb0e3806 (diff) |
global: Reorder `testing.TB` before `context.Context` arguments
A few weeks ago we have decided that `testing.TB` arguments should be
first, `context.Context` second. This is rather a matter of perssnal
taste instead of correctness, but we should strive for consistency.
Reorder all arguments to match the agreed-upon style.
Diffstat (limited to 'internal/gitaly/service/conflicts')
3 files changed, 19 insertions, 19 deletions
diff --git a/internal/gitaly/service/conflicts/list_conflict_files_test.go b/internal/gitaly/service/conflicts/list_conflict_files_test.go index 6052ccd01..64e67216b 100644 --- a/internal/gitaly/service/conflicts/list_conflict_files_test.go +++ b/internal/gitaly/service/conflicts/list_conflict_files_test.go @@ -22,7 +22,7 @@ type conflictFile struct { func TestSuccessfulListConflictFilesRequest(t *testing.T) { ctx := testhelper.Context(t) - _, repo, _, client := setupConflictsService(ctx, t, nil) + _, repo, _, client := setupConflictsService(t, ctx, nil) ourCommitOid := "1a35b5a77cf6af7edf6703f88e82f6aff613666f" theirCommitOid := "8309e68585b28d61eb85b7e2834849dda6bf1733" @@ -88,7 +88,7 @@ end func TestSuccessfulListConflictFilesRequestWithAncestor(t *testing.T) { ctx := testhelper.Context(t) - _, repo, _, client := setupConflictsService(ctx, t, nil) + _, repo, _, client := setupConflictsService(t, ctx, nil) ourCommitOid := "824be604a34828eb682305f0d963056cfac87b2d" theirCommitOid := "1450cd639e0bc6721eb02800169e464f212cde06" @@ -134,7 +134,7 @@ func TestSuccessfulListConflictFilesRequestWithAncestor(t *testing.T) { func TestListConflictFilesHugeDiff(t *testing.T) { ctx := testhelper.Context(t) - cfg, repo, repoPath, client := setupConflictsService(ctx, t, nil) + cfg, repo, repoPath, client := setupConflictsService(t, ctx, nil) ourCommitID := gittest.WriteCommit(t, cfg, repoPath, gittest.WithTreeEntries( gittest.TreeEntry{Path: "a", Mode: "100644", Content: strings.Repeat("a\n", 128*1024)}, @@ -173,7 +173,7 @@ func TestListConflictFilesHugeDiff(t *testing.T) { func TestListConflictFilesFailedPrecondition(t *testing.T) { ctx := testhelper.Context(t) - _, repo, _, client := setupConflictsService(ctx, t, nil) + _, repo, _, client := setupConflictsService(t, ctx, nil) testCases := []struct { desc string @@ -230,7 +230,7 @@ func TestListConflictFilesFailedPrecondition(t *testing.T) { func TestListConflictFilesAllowTreeConflicts(t *testing.T) { ctx := testhelper.Context(t) - _, repo, _, client := setupConflictsService(ctx, t, nil) + _, repo, _, client := setupConflictsService(t, ctx, nil) ourCommitOid := "eb227b3e214624708c474bdab7bde7afc17cefcc" theirCommitOid := "824be604a34828eb682305f0d963056cfac87b2d" @@ -322,7 +322,7 @@ end func TestFailedListConflictFilesRequestDueToValidation(t *testing.T) { ctx := testhelper.Context(t) - _, repo, _, client := setupConflictsService(ctx, t, nil) + _, repo, _, client := setupConflictsService(t, ctx, 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 d1b0ed41f..f4374784c 100644 --- a/internal/gitaly/service/conflicts/resolve_conflicts_test.go +++ b/internal/gitaly/service/conflicts/resolve_conflicts_test.go @@ -69,7 +69,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, hookManager) + cfg, repoProto, repoPath, client := setupConflictsService(t, ctx, hookManager) repo := localrepo.NewTestRepo(t, cfg, repoProto) @@ -203,7 +203,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, hookManager) + cfg, sourceRepo, sourceRepoPath, client := setupConflictsService(t, ctx, hookManager) testcfg.BuildGitalySSH(t, cfg) testcfg.BuildGitalyHooks(t, cfg) @@ -216,7 +216,7 @@ func TestResolveConflictsWithRemoteRepo(t *testing.T) { ) gittest.Exec(t, cfg, "-C", sourceRepoPath, "update-ref", "refs/heads/source", sourceCommitOID.String()) - targetRepo, targetRepoPath := gittest.CreateRepository(ctx, t, cfg, gittest.CreateRepositoryConfig{ + targetRepo, targetRepoPath := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{ Seed: gittest.SeedGitLabTest, }) targetBlobOID := gittest.WriteBlob(t, cfg, targetRepoPath, []byte("contents-2\n")) @@ -273,7 +273,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, hookManager) + cfg, repo, repoPath, client := setupConflictsService(t, ctx, hookManager) ctx = testhelper.MergeOutgoingMetadata(ctx, testcfg.GitalyServersMetadataFromCfg(t, cfg)) @@ -393,7 +393,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, hookManager) + cfg, repoProto, _, client := setupConflictsService(t, ctx, hookManager) ctx = testhelper.MergeOutgoingMetadata(ctx, testcfg.GitalyServersMetadataFromCfg(t, cfg)) @@ -431,7 +431,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, hookManager) + cfg, repoProto, repoPath, client := setupConflictsService(t, ctx, hookManager) repo := localrepo.NewTestRepo(t, cfg, repoProto) @@ -528,7 +528,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, hookManager) + cfg, repoProto, _, client := setupConflictsService(t, ctx, hookManager) repo := localrepo.NewTestRepo(t, cfg, repoProto) @@ -596,7 +596,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, hookManager) + cfg, repo, _, client := setupConflictsService(t, ctx, hookManager) mdGS := testcfg.GitalyServersMetadataFromCfg(t, cfg) mdFF, _ := metadata.FromOutgoingContext(ctx) @@ -652,7 +652,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, hookManager) + cfg, repo, _, client := setupConflictsService(t, ctx, hookManager) mdGS := testcfg.GitalyServersMetadataFromCfg(t, cfg) ourCommitOid := "1450cd639e0bc6721eb02800169e464f212cde06" @@ -818,7 +818,7 @@ func TestResolveConflictsQuarantine(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - cfg, sourceRepoProto, sourceRepoPath, client := setupConflictsService(ctx, t, nil) + cfg, sourceRepoProto, sourceRepoPath, client := setupConflictsService(t, ctx, nil) testcfg.BuildGitalySSH(t, cfg) testcfg.BuildGitalyHooks(t, cfg) @@ -843,7 +843,7 @@ func TestResolveConflictsQuarantine(t *testing.T) { exit 1 `)) - targetRepoProto, targetRepoPath := gittest.CreateRepository(ctx, t, cfg, gittest.CreateRepositoryConfig{ + targetRepoProto, targetRepoPath := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{ Seed: gittest.SeedGitLabTest, }) targetBlobOID := gittest.WriteBlob(t, cfg, targetRepoPath, []byte("contents-2\n")) diff --git a/internal/gitaly/service/conflicts/testhelper_test.go b/internal/gitaly/service/conflicts/testhelper_test.go index d7add6e0b..0c9d3cfa3 100644 --- a/internal/gitaly/service/conflicts/testhelper_test.go +++ b/internal/gitaly/service/conflicts/testhelper_test.go @@ -26,7 +26,7 @@ func TestMain(m *testing.M) { testhelper.Run(m) } -func setupConflictsService(ctx context.Context, tb testing.TB, hookManager hook.Manager) (config.Cfg, *gitalypb.Repository, string, gitalypb.ConflictsServiceClient) { +func setupConflictsService(tb testing.TB, ctx context.Context, hookManager hook.Manager) (config.Cfg, *gitalypb.Repository, string, gitalypb.ConflictsServiceClient) { cfg := testcfg.Build(tb) testcfg.BuildGitalyGit2Go(tb, cfg) @@ -37,7 +37,7 @@ func setupConflictsService(ctx context.Context, tb testing.TB, hookManager hook. client, conn := NewConflictsClient(tb, serverSocketPath) tb.Cleanup(func() { conn.Close() }) - repo, repoPath := gittest.CreateRepository(ctx, tb, cfg, gittest.CreateRepositoryConfig{ + repo, repoPath := gittest.CreateRepository(tb, ctx, cfg, gittest.CreateRepositoryConfig{ Seed: gittest.SeedGitLabTest, }) |