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 /cmd | |
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 'cmd')
-rw-r--r-- | cmd/gitaly-backup/create_test.go | 2 | ||||
-rw-r--r-- | cmd/gitaly-backup/restore_test.go | 4 | ||||
-rw-r--r-- | cmd/gitaly-git2go/merge_test.go | 2 | ||||
-rw-r--r-- | cmd/gitaly-hooks/hooks_test.go | 2 | ||||
-rw-r--r-- | cmd/praefect/subcmd_list_untracked_repositories_test.go | 6 | ||||
-rw-r--r-- | cmd/praefect/subcmd_remove_repository_test.go | 12 |
6 files changed, 14 insertions, 14 deletions
diff --git a/cmd/gitaly-backup/create_test.go b/cmd/gitaly-backup/create_test.go index 324afdaad..370291bb6 100644 --- a/cmd/gitaly-backup/create_test.go +++ b/cmd/gitaly-backup/create_test.go @@ -30,7 +30,7 @@ func TestCreateSubcommand(t *testing.T) { var repos []*gitalypb.Repository for i := 0; i < 5; i++ { - repo, _ := gittest.CreateRepository(ctx, t, cfg, gittest.CreateRepositoryConfig{ + repo, _ := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{ Seed: gittest.SeedGitLabTest, RelativePath: fmt.Sprintf("repo-%d", i), }) diff --git a/cmd/gitaly-backup/restore_test.go b/cmd/gitaly-backup/restore_test.go index 5e3b0ae0d..c828ad3c3 100644 --- a/cmd/gitaly-backup/restore_test.go +++ b/cmd/gitaly-backup/restore_test.go @@ -29,7 +29,7 @@ func TestRestoreSubcommand(t *testing.T) { cfg.SocketPath = testserver.RunGitalyServer(t, cfg, nil, setup.RegisterAll) - existingRepo, existRepoPath := gittest.CreateRepository(ctx, t, cfg, gittest.CreateRepositoryConfig{ + existingRepo, existRepoPath := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{ Seed: gittest.SeedGitLabTest, RelativePath: "existing_repo", }) @@ -76,7 +76,7 @@ func TestRestoreSubcommand(t *testing.T) { "restore: pipeline: 1 failures encountered:\n - invalid: manager: remove repository: could not dial source: invalid connection string: \"invalid\"\n") for _, repo := range repos { - repoPath := filepath.Join(cfg.Storages[0].Path, gittest.GetReplicaPath(ctx, t, cfg, repo)) + repoPath := filepath.Join(cfg.Storages[0].Path, gittest.GetReplicaPath(t, ctx, cfg, repo)) bundlePath := filepath.Join(path, repo.RelativePath+".bundle") output := gittest.Exec(t, cfg, "-C", repoPath, "bundle", "verify", bundlePath) diff --git a/cmd/gitaly-git2go/merge_test.go b/cmd/gitaly-git2go/merge_test.go index 123b8cca6..00cc5549f 100644 --- a/cmd/gitaly-git2go/merge_test.go +++ b/cmd/gitaly-git2go/merge_test.go @@ -418,7 +418,7 @@ func TestMerge_recursive(t *testing.T) { testcfg.BuildGitalyGit2Go(t, cfg) executor := buildExecutor(t, cfg) - repoProto, repoPath := gittest.CreateRepository(ctx, t, cfg, gittest.CreateRepositoryConfig{ + repoProto, repoPath := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{ SkipCreationViaService: true, }) diff --git a/cmd/gitaly-hooks/hooks_test.go b/cmd/gitaly-hooks/hooks_test.go index b5479123c..f2549e6aa 100644 --- a/cmd/gitaly-hooks/hooks_test.go +++ b/cmd/gitaly-hooks/hooks_test.go @@ -273,7 +273,7 @@ func TestHooksUpdate(t *testing.T) { } func testHooksUpdate(t *testing.T, ctx context.Context, cfg config.Cfg, glValues glHookValues) { - repo, repoPath := gittest.CreateRepository(ctx, t, cfg, gittest.CreateRepositoryConfig{ + repo, repoPath := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{ SkipCreationViaService: true, }) diff --git a/cmd/praefect/subcmd_list_untracked_repositories_test.go b/cmd/praefect/subcmd_list_untracked_repositories_test.go index 71180d856..690df12d6 100644 --- a/cmd/praefect/subcmd_list_untracked_repositories_test.go +++ b/cmd/praefect/subcmd_list_untracked_repositories_test.go @@ -95,13 +95,13 @@ func TestListUntrackedRepositories_Exec(t *testing.T) { require.NoError(t, fs.Parse([]string{"-older-than", "4h"})) // Repositories not managed by praefect. - repo1, repo1Path := gittest.CreateRepository(ctx, t, g1Cfg, gittest.CreateRepositoryConfig{ + repo1, repo1Path := gittest.CreateRepository(t, ctx, g1Cfg, gittest.CreateRepositoryConfig{ SkipCreationViaService: true, }) - repo2, repo2Path := gittest.CreateRepository(ctx, t, g1Cfg, gittest.CreateRepositoryConfig{ + repo2, repo2Path := gittest.CreateRepository(t, ctx, g1Cfg, gittest.CreateRepositoryConfig{ SkipCreationViaService: true, }) - _, _ = gittest.CreateRepository(ctx, t, g2Cfg, gittest.CreateRepositoryConfig{ + _, _ = gittest.CreateRepository(t, ctx, g2Cfg, gittest.CreateRepositoryConfig{ SkipCreationViaService: true, }) diff --git a/cmd/praefect/subcmd_remove_repository_test.go b/cmd/praefect/subcmd_remove_repository_test.go index e42bde82e..57c6d1bed 100644 --- a/cmd/praefect/subcmd_remove_repository_test.go +++ b/cmd/praefect/subcmd_remove_repository_test.go @@ -120,7 +120,7 @@ func TestRemoveRepository_Exec(t *testing.T) { t.Run("dry run", func(t *testing.T) { var out bytes.Buffer repo := createRepo(t, ctx, repoClient, praefectStorage, t.Name()) - replicaPath := gittest.GetReplicaPath(ctx, t, gitalycfg.Cfg{SocketPath: praefectServer.Address()}, repo) + replicaPath := gittest.GetReplicaPath(t, ctx, gitalycfg.Cfg{SocketPath: praefectServer.Address()}, repo) cmd := &removeRepository{ logger: testhelper.NewDiscardingLogger(t), @@ -143,7 +143,7 @@ func TestRemoveRepository_Exec(t *testing.T) { t.Run("ok", func(t *testing.T) { var out bytes.Buffer repo := createRepo(t, ctx, repoClient, praefectStorage, t.Name()) - replicaPath := gittest.GetReplicaPath(ctx, t, gitalycfg.Cfg{SocketPath: praefectServer.Address()}, repo) + replicaPath := gittest.GetReplicaPath(t, ctx, gitalycfg.Cfg{SocketPath: praefectServer.Address()}, repo) require.DirExists(t, filepath.Join(g1Cfg.Storages[0].Path, replicaPath)) require.DirExists(t, filepath.Join(g2Cfg.Storages[0].Path, replicaPath)) @@ -169,7 +169,7 @@ func TestRemoveRepository_Exec(t *testing.T) { t.Run("db only", func(t *testing.T) { var out bytes.Buffer repo := createRepo(t, ctx, repoClient, praefectStorage, t.Name()) - replicaPath := gittest.GetReplicaPath(ctx, t, gitalycfg.Cfg{SocketPath: praefectServer.Address()}, repo) + replicaPath := gittest.GetReplicaPath(t, ctx, gitalycfg.Cfg{SocketPath: praefectServer.Address()}, repo) cmd := &removeRepository{ logger: testhelper.NewDiscardingLogger(t), @@ -197,7 +197,7 @@ func TestRemoveRepository_Exec(t *testing.T) { t.Run("repository doesnt exist on one gitaly", func(t *testing.T) { var out bytes.Buffer repo := createRepo(t, ctx, repoClient, praefectStorage, t.Name()) - replicaPath := gittest.GetReplicaPath(ctx, t, gitalycfg.Cfg{SocketPath: praefectServer.Address()}, repo) + replicaPath := gittest.GetReplicaPath(t, ctx, gitalycfg.Cfg{SocketPath: praefectServer.Address()}, repo) require.DirExists(t, filepath.Join(g2Cfg.Storages[0].Path, replicaPath)) require.DirExists(t, filepath.Join(g1Cfg.Storages[0].Path, replicaPath)) @@ -225,7 +225,7 @@ func TestRemoveRepository_Exec(t *testing.T) { t.Run("no info about repository on praefect", func(t *testing.T) { var out bytes.Buffer repo := createRepo(t, ctx, repoClient, praefectStorage, t.Name()) - replicaPath := gittest.GetReplicaPath(ctx, t, gitalycfg.Cfg{SocketPath: praefectServer.Address()}, repo) + replicaPath := gittest.GetReplicaPath(t, ctx, gitalycfg.Cfg{SocketPath: praefectServer.Address()}, repo) repoStore := datastore.NewPostgresRepositoryStore(db.DB, nil) _, _, err = repoStore.DeleteRepository(ctx, repo.StorageName, repo.RelativePath) @@ -251,7 +251,7 @@ func TestRemoveRepository_Exec(t *testing.T) { repo := createRepo(t, ctx, repoClient, praefectStorage, t.Name()) g2Srv.Shutdown() - replicaPath := gittest.GetReplicaPath(ctx, t, gitalycfg.Cfg{SocketPath: praefectServer.Address()}, repo) + replicaPath := gittest.GetReplicaPath(t, ctx, gitalycfg.Cfg{SocketPath: praefectServer.Address()}, repo) require.DirExists(t, filepath.Join(g1Cfg.Storages[0].Path, replicaPath)) require.DirExists(t, filepath.Join(g2Cfg.Storages[0].Path, replicaPath)) |