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>2021-03-01 12:48:53 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-03-01 12:48:53 +0300
commitbe99c5da09c2847ebd4b32584aba24448a394e8b (patch)
tree0cfd2370b4ee4fb9930b93bb557ff4e8a89857f8
parent141c3b4899804abd9d2bab26a5fe55497e54e1e8 (diff)
testhelper: Move repository helpers into `gittest`
It's currently not possible to use our git DSL in the testhelper package because of an import cycle between the testhelper and git package. To fix this import cycle, we thus move test-related git helpers into the gittest package. This commit moves the repository helpers. As we're already touching all sites which use these helpers anyway, it also aligns functions to have more consistent naming.
-rw-r--r--cmd/gitaly-git2go/cherry_pick_test.go5
-rw-r--r--cmd/gitaly-git2go/conflicts/conflicts_test.go3
-rw-r--r--cmd/gitaly-git2go/merge_test.go7
-rw-r--r--cmd/gitaly-git2go/revert_test.go5
-rw-r--r--cmd/gitaly-git2go/submodule_test.go3
-rw-r--r--cmd/gitaly-hooks/hooks_test.go10
-rw-r--r--cmd/gitaly-ssh/auth_test.go3
-rw-r--r--cmd/gitaly-ssh/upload_pack_test.go3
-rw-r--r--internal/cache/cachedb_test.go5
-rw-r--r--internal/git/gittest/repo.go (renamed from internal/testhelper/repo.go)59
-rw-r--r--internal/git/gittest/repository_suite.go4
-rw-r--r--internal/git/housekeeping/housekeeping_test.go3
-rw-r--r--internal/git/localrepo/config_test.go9
-rw-r--r--internal/git/localrepo/objects_test.go9
-rw-r--r--internal/git/localrepo/refs_test.go15
-rw-r--r--internal/git/localrepo/remote_test.go31
-rw-r--r--internal/git/log/commit_test.go5
-rw-r--r--internal/git/log/tag_test.go3
-rw-r--r--internal/git/objectpool/clone_test.go9
-rw-r--r--internal/git/objectpool/fetch_test.go16
-rw-r--r--internal/git/objectpool/link_test.go8
-rw-r--r--internal/git/objectpool/pool_test.go23
-rw-r--r--internal/git/objectpool/testhelper_test.go3
-rw-r--r--internal/git/stats/analyzehttp_test.go4
-rw-r--r--internal/git/stats/git_test.go5
-rw-r--r--internal/git/stats/profile_test.go2
-rw-r--r--internal/git/updateref/updateref_test.go3
-rw-r--r--internal/git2go/apply_test.go2
-rw-r--r--internal/git2go/commit_test.go2
-rw-r--r--internal/gitaly/hook/access_test.go7
-rw-r--r--internal/gitaly/hook/custom_test.go13
-rw-r--r--internal/gitaly/hook/postreceive_test.go4
-rw-r--r--internal/gitaly/hook/prereceive_test.go4
-rw-r--r--internal/gitaly/hook/transactions_test.go4
-rw-r--r--internal/gitaly/hook/update_test.go2
-rw-r--r--internal/gitaly/rubyserver/proxy_test.go7
-rw-r--r--internal/gitaly/rubyserver/rubyserver_test.go3
-rw-r--r--internal/gitaly/server/auth_test.go2
-rw-r--r--internal/gitaly/service/blob/get_blob_test.go7
-rw-r--r--internal/gitaly/service/blob/get_blobs_test.go5
-rw-r--r--internal/gitaly/service/blob/lfs_pointers_test.go16
-rw-r--r--internal/gitaly/service/cleanup/apply_bfg_object_map_stream_test.go5
-rw-r--r--internal/gitaly/service/commit/between_test.go5
-rw-r--r--internal/gitaly/service/commit/commit_messages_test.go2
-rw-r--r--internal/gitaly/service/commit/commit_signatures_test.go5
-rw-r--r--internal/gitaly/service/commit/commits_by_message_test.go5
-rw-r--r--internal/gitaly/service/commit/count_commits_test.go7
-rw-r--r--internal/gitaly/service/commit/count_diverging_commits_test.go5
-rw-r--r--internal/gitaly/service/commit/filter_shas_with_signatures_test.go3
-rw-r--r--internal/gitaly/service/commit/find_all_commits_test.go5
-rw-r--r--internal/gitaly/service/commit/find_commit_test.go8
-rw-r--r--internal/gitaly/service/commit/find_commits_test.go12
-rw-r--r--internal/gitaly/service/commit/isancestor_test.go6
-rw-r--r--internal/gitaly/service/commit/languages_test.go11
-rw-r--r--internal/gitaly/service/commit/last_commit_for_path_test.go6
-rw-r--r--internal/gitaly/service/commit/list_commits_by_oid_test.go5
-rw-r--r--internal/gitaly/service/commit/list_commits_by_ref_name_test.go5
-rw-r--r--internal/gitaly/service/commit/list_files_test.go7
-rw-r--r--internal/gitaly/service/commit/list_last_commits_for_tree_test.go8
-rw-r--r--internal/gitaly/service/commit/raw_blame_test.go5
-rw-r--r--internal/gitaly/service/commit/stats_test.go5
-rw-r--r--internal/gitaly/service/commit/tree_entries_test.go9
-rw-r--r--internal/gitaly/service/commit/tree_entry_test.go5
-rw-r--r--internal/gitaly/service/conflicts/list_conflict_files_test.go11
-rw-r--r--internal/gitaly/service/conflicts/resolve_conflicts_test.go9
-rw-r--r--internal/gitaly/service/diff/commit_test.go23
-rw-r--r--internal/gitaly/service/diff/find_changed_paths_test.go5
-rw-r--r--internal/gitaly/service/diff/numstat_test.go5
-rw-r--r--internal/gitaly/service/diff/raw_test.go15
-rw-r--r--internal/gitaly/service/hook/pack_objects_test.go5
-rw-r--r--internal/gitaly/service/hook/post_receive_test.go5
-rw-r--r--internal/gitaly/service/hook/pre_receive_test.go8
-rw-r--r--internal/gitaly/service/hook/reference_transaction_test.go3
-rw-r--r--internal/gitaly/service/hook/update_test.go2
-rw-r--r--internal/gitaly/service/internalgitaly/walkrepos_test.go7
-rw-r--r--internal/gitaly/service/objectpool/alternates_test.go11
-rw-r--r--internal/gitaly/service/objectpool/create_test.go13
-rw-r--r--internal/gitaly/service/objectpool/fetch_into_object_pool_test.go16
-rw-r--r--internal/gitaly/service/objectpool/get_test.go9
-rw-r--r--internal/gitaly/service/objectpool/link_test.go30
-rw-r--r--internal/gitaly/service/objectpool/reduplicate_test.go5
-rw-r--r--internal/gitaly/service/operations/apply_patch_test.go9
-rw-r--r--internal/gitaly/service/operations/branches_test.go26
-rw-r--r--internal/gitaly/service/operations/cherry_pick_test.go20
-rw-r--r--internal/gitaly/service/operations/commit_files_test.go28
-rw-r--r--internal/gitaly/service/operations/merge_test.go30
-rw-r--r--internal/gitaly/service/operations/rebase_test.go34
-rw-r--r--internal/gitaly/service/operations/revert_test.go20
-rw-r--r--internal/gitaly/service/operations/squash_test.go17
-rw-r--r--internal/gitaly/service/operations/submodules_test.go15
-rw-r--r--internal/gitaly/service/operations/tags_test.go36
-rw-r--r--internal/gitaly/service/operations/update_branches_test.go10
-rw-r--r--internal/gitaly/service/operations/update_with_hooks_test.go5
-rw-r--r--internal/gitaly/service/ref/branches_test.go5
-rw-r--r--internal/gitaly/service/ref/delete_refs_test.go7
-rw-r--r--internal/gitaly/service/ref/list_new_blobs_test.go3
-rw-r--r--internal/gitaly/service/ref/list_new_commits_test.go3
-rw-r--r--internal/gitaly/service/ref/pack_refs_test.go3
-rw-r--r--internal/gitaly/service/ref/refexists_test.go3
-rw-r--r--internal/gitaly/service/ref/refname_test.go9
-rw-r--r--internal/gitaly/service/ref/refs_test.go40
-rw-r--r--internal/gitaly/service/ref/remote_branches_test.go4
-rw-r--r--internal/gitaly/service/ref/tag_messages_test.go3
-rw-r--r--internal/gitaly/service/remote/fetch_internal_remote_test.go4
-rw-r--r--internal/gitaly/service/remote/find_remote_root_ref_test.go7
-rw-r--r--internal/gitaly/service/remote/remotes_test.go17
-rw-r--r--internal/gitaly/service/remote/update_remote_mirror_test.go14
-rw-r--r--internal/gitaly/service/repository/apply_gitattributes_test.go7
-rw-r--r--internal/gitaly/service/repository/archive_test.go15
-rw-r--r--internal/gitaly/service/repository/backup_custom_hooks_test.go7
-rw-r--r--internal/gitaly/service/repository/calculate_checksum_test.go9
-rw-r--r--internal/gitaly/service/repository/cleanup_test.go21
-rw-r--r--internal/gitaly/service/repository/clone_from_pool_internal_test.go6
-rw-r--r--internal/gitaly/service/repository/clone_from_pool_test.go2
-rw-r--r--internal/gitaly/service/repository/commit_graph_test.go4
-rw-r--r--internal/gitaly/service/repository/config_test.go5
-rw-r--r--internal/gitaly/service/repository/create_bundle_test.go2
-rw-r--r--internal/gitaly/service/repository/create_from_bundle_test.go5
-rw-r--r--internal/gitaly/service/repository/create_from_snapshot_test.go11
-rw-r--r--internal/gitaly/service/repository/create_from_url_test.go2
-rw-r--r--internal/gitaly/service/repository/create_test.go3
-rw-r--r--internal/gitaly/service/repository/fetch_remote_test.go14
-rw-r--r--internal/gitaly/service/repository/fetch_test.go2
-rw-r--r--internal/gitaly/service/repository/fork_test.go5
-rw-r--r--internal/gitaly/service/repository/fsck_test.go7
-rw-r--r--internal/gitaly/service/repository/gc_test.go16
-rw-r--r--internal/gitaly/service/repository/info_attributes_test.go5
-rw-r--r--internal/gitaly/service/repository/license_test.go3
-rw-r--r--internal/gitaly/service/repository/merge_base_test.go5
-rw-r--r--internal/gitaly/service/repository/midx_test.go8
-rw-r--r--internal/gitaly/service/repository/optimize_test.go6
-rw-r--r--internal/gitaly/service/repository/raw_changes_test.go12
-rw-r--r--internal/gitaly/service/repository/rebase_in_progress_test.go5
-rw-r--r--internal/gitaly/service/repository/remove_test.go3
-rw-r--r--internal/gitaly/service/repository/rename_test.go8
-rw-r--r--internal/gitaly/service/repository/repack_test.go12
-rw-r--r--internal/gitaly/service/repository/replicate_test.go8
-rw-r--r--internal/gitaly/service/repository/repository_test.go5
-rw-r--r--internal/gitaly/service/repository/restore_custom_hooks_test.go5
-rw-r--r--internal/gitaly/service/repository/search_files_test.go9
-rw-r--r--internal/gitaly/service/repository/size_test.go5
-rw-r--r--internal/gitaly/service/repository/snapshot_test.go16
-rw-r--r--internal/gitaly/service/repository/squash_in_progress_test.go5
-rw-r--r--internal/gitaly/service/repository/write_ref_test.go5
-rw-r--r--internal/gitaly/service/smarthttp/inforefs_test.go16
-rw-r--r--internal/gitaly/service/smarthttp/receive_pack_test.go22
-rw-r--r--internal/gitaly/service/smarthttp/upload_pack_test.go12
-rw-r--r--internal/gitaly/service/ssh/receive_pack_test.go8
-rw-r--r--internal/gitaly/service/ssh/upload_archive_test.go5
-rw-r--r--internal/gitaly/service/ssh/upload_pack_test.go18
-rw-r--r--internal/gitaly/service/wiki/find_page_test.go3
-rw-r--r--internal/gitalyssh/gitalyssh_test.go3
-rw-r--r--internal/middleware/commandstatshandler/commandstatshandler_test.go3
-rw-r--r--internal/praefect/coordinator_test.go3
-rw-r--r--internal/praefect/info_service_test.go6
-rw-r--r--internal/praefect/middleware/errorhandler_test.go3
-rw-r--r--internal/praefect/replicator_test.go12
-rw-r--r--internal/praefect/server_factory_test.go3
-rw-r--r--internal/praefect/server_test.go5
-rw-r--r--internal/praefect/service/info/consistencycheck_test.go9
-rw-r--r--internal/tempdir/tempdir_test.go3
-rw-r--r--internal/testhelper/testcfg/gitaly_builder.go3
162 files changed, 765 insertions, 661 deletions
diff --git a/cmd/gitaly-git2go/cherry_pick_test.go b/cmd/gitaly-git2go/cherry_pick_test.go
index bda4c16ed..84f2c6043 100644
--- a/cmd/gitaly-git2go/cherry_pick_test.go
+++ b/cmd/gitaly-git2go/cherry_pick_test.go
@@ -11,13 +11,14 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
cmdtesthelper "gitlab.com/gitlab-org/gitaly/cmd/gitaly-git2go/testhelper"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git2go"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
)
func TestCherryPick_validation(t *testing.T) {
- _, repoPath, cleanup := testhelper.NewTestRepo(t)
+ _, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
testcases := []struct {
@@ -125,7 +126,7 @@ func TestCherryPick(t *testing.T) {
},
}
for _, tc := range testcases {
- _, repoPath, cleanup := testhelper.NewTestRepo(t)
+ _, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
base := cmdtesthelper.BuildCommit(t, repoPath, []*git.Oid{nil}, tc.base)
diff --git a/cmd/gitaly-git2go/conflicts/conflicts_test.go b/cmd/gitaly-git2go/conflicts/conflicts_test.go
index ca4f474a4..74a70df3d 100644
--- a/cmd/gitaly-git2go/conflicts/conflicts_test.go
+++ b/cmd/gitaly-git2go/conflicts/conflicts_test.go
@@ -9,6 +9,7 @@ import (
git "github.com/libgit2/git2go/v30"
"github.com/stretchr/testify/require"
cmdtesthelper "gitlab.com/gitlab-org/gitaly/cmd/gitaly-git2go/testhelper"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git2go"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -177,7 +178,7 @@ func TestConflicts(t *testing.T) {
}
for _, tc := range testcases {
- _, repoPath, cleanup := testhelper.NewTestRepo(t)
+ _, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
base := cmdtesthelper.BuildCommit(t, repoPath, nil, tc.base)
diff --git a/cmd/gitaly-git2go/merge_test.go b/cmd/gitaly-git2go/merge_test.go
index 523cd7f3b..99e807dc5 100644
--- a/cmd/gitaly-git2go/merge_test.go
+++ b/cmd/gitaly-git2go/merge_test.go
@@ -11,13 +11,14 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
cmdtesthelper "gitlab.com/gitlab-org/gitaly/cmd/gitaly-git2go/testhelper"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git2go"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
)
func TestMergeFailsWithMissingArguments(t *testing.T) {
- _, repoPath, cleanup := testhelper.NewTestRepo(t)
+ _, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
testcases := []struct {
@@ -172,7 +173,7 @@ func TestMergeTrees(t *testing.T) {
}
for _, tc := range testcases {
- _, repoPath, cleanup := testhelper.NewTestRepo(t)
+ _, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
base := cmdtesthelper.BuildCommit(t, repoPath, []*git.Oid{nil}, tc.base)
@@ -231,7 +232,7 @@ func TestMergeTrees(t *testing.T) {
}
func TestMerge_recursive(t *testing.T) {
- _, repoPath, cleanup := testhelper.InitBareRepo(t)
+ _, repoPath, cleanup := gittest.InitBareRepo(t)
defer cleanup()
base := cmdtesthelper.BuildCommit(t, repoPath, nil, map[string]string{"base": "base\n"})
diff --git a/cmd/gitaly-git2go/revert_test.go b/cmd/gitaly-git2go/revert_test.go
index 06e35ce55..cf58a0d09 100644
--- a/cmd/gitaly-git2go/revert_test.go
+++ b/cmd/gitaly-git2go/revert_test.go
@@ -11,13 +11,14 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
cmdtesthelper "gitlab.com/gitlab-org/gitaly/cmd/gitaly-git2go/testhelper"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git2go"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
)
func TestRevert_validation(t *testing.T) {
- _, repoPath, cleanup := testhelper.NewTestRepo(t)
+ _, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
testcases := []struct {
@@ -150,7 +151,7 @@ func TestRevert_trees(t *testing.T) {
}
for _, tc := range testcases {
t.Run(tc.desc, func(t *testing.T) {
- _, repoPath, cleanup := testhelper.NewTestRepo(t)
+ _, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
ours, revert := tc.setupRepo(t, repoPath)
diff --git a/cmd/gitaly-git2go/submodule_test.go b/cmd/gitaly-git2go/submodule_test.go
index 73a4230da..f242aaf41 100644
--- a/cmd/gitaly-git2go/submodule_test.go
+++ b/cmd/gitaly-git2go/submodule_test.go
@@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/internal/git/lstree"
"gitlab.com/gitlab-org/gitaly/internal/git2go"
@@ -86,7 +87,7 @@ func TestSubmodule(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), testRepo, config.Config)
diff --git a/cmd/gitaly-hooks/hooks_test.go b/cmd/gitaly-hooks/hooks_test.go
index 000f9be39..002957471 100644
--- a/cmd/gitaly-hooks/hooks_test.go
+++ b/cmd/gitaly-hooks/hooks_test.go
@@ -134,7 +134,7 @@ func TestHooksPrePostReceive(t *testing.T) {
}
func testHooksPrePostReceive(t *testing.T) {
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
secretToken := "secret token"
@@ -308,7 +308,7 @@ func testHooksUpdate(t *testing.T, gitlabShellDir, token string, glValues glHook
}(config.Config)
config.Config.Auth.Token = token
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
refval, oldval, newval := "refval", strings.Repeat("a", 40), strings.Repeat("b", 40)
@@ -373,7 +373,7 @@ func TestHooksPostReceiveFailed(t *testing.T) {
tempGitlabShellDir, cleanup := testhelper.TempDir(t)
defer cleanup()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
// By setting the last parameter to false, the post-receive API call will
@@ -503,7 +503,7 @@ func TestHooksNotAllowed(t *testing.T) {
tempGitlabShellDir, cleanup := testhelper.TempDir(t)
defer cleanup()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
c := testhelper.GitlabTestServerOptions{
@@ -685,7 +685,7 @@ func TestGitalyHooksPackObjects(t *testing.T) {
config.Config.Auth.Token = "abc123"
defer runHookServiceServer(t, config.Config.Auth.Token)()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
logDir, err := filepath.Abs("testdata")
diff --git a/cmd/gitaly-ssh/auth_test.go b/cmd/gitaly-ssh/auth_test.go
index b0c8b69d1..50160eb0c 100644
--- a/cmd/gitaly-ssh/auth_test.go
+++ b/cmd/gitaly-ssh/auth_test.go
@@ -14,6 +14,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/client"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/hook"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/server"
@@ -36,7 +37,7 @@ func TestConnectivity(t *testing.T) {
certPoolPath := filepath.Join(cwd, "testdata", "certs")
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
socketPath := testhelper.GetTemporaryGitalySocketFileName(t)
diff --git a/cmd/gitaly-ssh/upload_pack_test.go b/cmd/gitaly-ssh/upload_pack_test.go
index 231399501..f2036875f 100644
--- a/cmd/gitaly-ssh/upload_pack_test.go
+++ b/cmd/gitaly-ssh/upload_pack_test.go
@@ -9,6 +9,7 @@ import (
"github.com/golang/protobuf/jsonpb"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/updateref"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -21,7 +22,7 @@ func TestVisibilityOfHiddenRefs(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
socketPath := testhelper.GetTemporaryGitalySocketFileName(t)
diff --git a/internal/cache/cachedb_test.go b/internal/cache/cachedb_test.go
index 3a13f0372..3a7f44c0b 100644
--- a/internal/cache/cachedb_test.go
+++ b/internal/cache/cachedb_test.go
@@ -12,6 +12,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/cache"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -35,8 +36,8 @@ func TestStreamDBNaiveKeyer(t *testing.T) {
defer cfgBuilder.Cleanup()
cfg := cfgBuilder.Build(t)
- testRepo1 := testhelper.NewTestRepoAtStorage(t, cfg.Storages[0], "repository-1")
- testRepo2 := testhelper.NewTestRepoAtStorage(t, cfg.Storages[0], "repository-2")
+ testRepo1 := gittest.CloneRepoAtStorage(t, cfg.Storages[0], "repository-1")
+ testRepo2 := gittest.CloneRepoAtStorage(t, cfg.Storages[0], "repository-2")
keyer := cache.NewLeaseKeyer(config.NewLocator(cfg))
diff --git a/internal/testhelper/repo.go b/internal/git/gittest/repo.go
index 525c760cd..53bac2e1a 100644
--- a/internal/testhelper/repo.go
+++ b/internal/git/gittest/repo.go
@@ -1,4 +1,4 @@
-package testhelper
+package gittest
import (
"crypto/sha256"
@@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/helper/text"
+ "gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
)
@@ -23,8 +24,8 @@ const (
GlProjectPath = "gitlab-org/gitlab-test"
)
-// CreateRepo creates a temporary directory for a repo, without initializing it
-func CreateRepo(t testing.TB, storagePath, relativePath string) *gitalypb.Repository {
+// InitRepoDir creates a temporary directory for a repo, without initializing it
+func InitRepoDir(t testing.TB, storagePath, relativePath string) *gitalypb.Repository {
repoPath := filepath.Join(storagePath, relativePath, "..")
require.NoError(t, os.MkdirAll(repoPath, 0755), "making repo parent dir")
return &gitalypb.Repository{
@@ -45,9 +46,9 @@ func InitRepoWithWorktree(t testing.TB) (*gitalypb.Repository, string, func()) {
return initRepo(t, false)
}
-// NewTestObjectPoolName returns a random pool repository name
-// in format '@pools/[0-9a-z]{2}/[0-9a-z]{2}/[0-9a-z]{64}.git'.
-func NewTestObjectPoolName(t testing.TB) string {
+// NewObjectPoolName returns a random pool repository name in format
+// '@pools/[0-9a-z]{2}/[0-9a-z]{2}/[0-9a-z]{64}.git'.
+func NewObjectPoolName(t testing.TB) string {
return filepath.Join("@pools", newDiskHash(t)+".git")
}
@@ -74,7 +75,7 @@ func newDiskHash(t testing.TB) string {
}
func initRepo(t testing.TB, bare bool) (*gitalypb.Repository, string, func()) {
- storagePath := GitlabTestStoragePath()
+ storagePath := testhelper.GitlabTestStoragePath()
relativePath := NewRepositoryName(t, bare)
repoPath := filepath.Join(storagePath, relativePath)
@@ -83,9 +84,9 @@ func initRepo(t testing.TB, bare bool) (*gitalypb.Repository, string, func()) {
args = append(args, "--bare")
}
- MustRunCommand(t, nil, "git", append(args, repoPath)...)
+ testhelper.MustRunCommand(t, nil, "git", append(args, repoPath)...)
- repo := CreateRepo(t, storagePath, relativePath)
+ repo := InitRepoDir(t, storagePath, relativePath)
if !bare {
repo.RelativePath = filepath.Join(repo.RelativePath, ".git")
}
@@ -93,28 +94,28 @@ func initRepo(t testing.TB, bare bool) (*gitalypb.Repository, string, func()) {
return repo, repoPath, func() { require.NoError(t, os.RemoveAll(repoPath)) }
}
-// NewTestRepoTo clones a new copy of test repository under a subdirectory in the storage root.
-func NewTestRepoTo(t testing.TB, storageRoot, relativePath string) *gitalypb.Repository {
- repo, _, _ := cloneTestRepo(t, storageRoot, relativePath, true)
+// CloneRepoAtStorageRoot clones a new copy of test repository under a subdirectory in the storage root.
+func CloneRepoAtStorageRoot(t testing.TB, storageRoot, relativePath string) *gitalypb.Repository {
+ repo, _, _ := cloneRepo(t, storageRoot, relativePath, true)
return repo
}
-// NewTestRepoAtStorage clones a new copy of test repository under a subdirectory in the storage root.
-func NewTestRepoAtStorage(t testing.TB, storage config.Storage, relativePath string) *gitalypb.Repository {
- repo, _, _ := cloneTestRepo(t, storage.Path, relativePath, true)
+// CloneRepoAtStorage clones a new copy of test repository under a subdirectory in the storage root.
+func CloneRepoAtStorage(t testing.TB, storage config.Storage, relativePath string) *gitalypb.Repository {
+ repo, _, _ := cloneRepo(t, storage.Path, relativePath, true)
repo.StorageName = storage.Name
return repo
}
-// NewTestRepo creates a bare copy of the test repository..
-func NewTestRepo(t testing.TB) (repo *gitalypb.Repository, repoPath string, cleanup func()) {
- return cloneTestRepo(t, GitlabTestStoragePath(), NewRepositoryName(t, true), true)
+// CloneRepo creates a bare copy of the test repository.
+func CloneRepo(t testing.TB) (repo *gitalypb.Repository, repoPath string, cleanup func()) {
+ return cloneRepo(t, testhelper.GitlabTestStoragePath(), NewRepositoryName(t, true), true)
}
-// NewTestRepoWithWorktree creates a copy of the test repository with a
-// worktree. This is allows you to run normal 'non-bare' Git commands.
-func NewTestRepoWithWorktree(t testing.TB) (repo *gitalypb.Repository, repoPath string, cleanup func()) {
- return cloneTestRepo(t, GitlabTestStoragePath(), NewRepositoryName(t, false), false)
+// CloneRepoWithWorktree creates a copy of the test repository with a worktree. This is allows you
+// to run normal 'non-bare' Git commands.
+func CloneRepoWithWorktree(t testing.TB) (repo *gitalypb.Repository, repoPath string, cleanup func()) {
+ return cloneRepo(t, testhelper.GitlabTestStoragePath(), NewRepositoryName(t, false), false)
}
// testRepositoryPath returns the absolute path of local 'gitlab-org/gitlab-test.git' clone.
@@ -125,12 +126,12 @@ func testRepositoryPath(t testing.TB) string {
require.Fail(t, "could not get caller info")
}
- path := filepath.Join(filepath.Dir(currentFile), "..", "..", "_build", "testrepos", "gitlab-test.git")
+ path := filepath.Join(filepath.Dir(currentFile), "..", "..", "..", "_build", "testrepos", "gitlab-test.git")
if !isValidRepoPath(path) {
- makePath := filepath.Join(filepath.Dir(currentFile), "..", "..")
+ makePath := filepath.Join(filepath.Dir(currentFile), "..", "..", "..")
makeTarget := "prepare-test-repos"
log.Printf("local clone of 'gitlab-org/gitlab-test.git' not found in %q, running `make %v`", path, makeTarget)
- MustRunCommand(t, nil, "make", "-C", makePath, makeTarget)
+ testhelper.MustRunCommand(t, nil, "make", "-C", makePath, makeTarget)
}
return path
@@ -145,10 +146,10 @@ func isValidRepoPath(absolutePath string) bool {
return true
}
-func cloneTestRepo(t testing.TB, storageRoot, relativePath string, bare bool) (repo *gitalypb.Repository, repoPath string, cleanup func()) {
+func cloneRepo(t testing.TB, storageRoot, relativePath string, bare bool) (repo *gitalypb.Repository, repoPath string, cleanup func()) {
repoPath = filepath.Join(storageRoot, relativePath)
- repo = CreateRepo(t, storageRoot, relativePath)
+ repo = InitRepoDir(t, storageRoot, relativePath)
args := []string{"clone", "--no-hardlinks", "--dissociate"}
if bare {
args = append(args, "--bare")
@@ -157,7 +158,7 @@ func cloneTestRepo(t testing.TB, storageRoot, relativePath string, bare bool) (r
repo.RelativePath = filepath.Join(relativePath, ".git")
}
- MustRunCommand(t, nil, "git", append(args, testRepositoryPath(t), repoPath)...)
+ testhelper.MustRunCommand(t, nil, "git", append(args, testRepositoryPath(t), repoPath)...)
return repo, repoPath, func() { require.NoError(t, os.RemoveAll(repoPath)) }
}
@@ -170,5 +171,5 @@ func AddWorktreeArgs(repoPath, worktreeName string) []string {
// AddWorktree creates a worktree in the repository path for tests
func AddWorktree(t testing.TB, repoPath string, worktreeName string) {
- MustRunCommand(t, nil, "git", AddWorktreeArgs(repoPath, worktreeName)...)
+ testhelper.MustRunCommand(t, nil, "git", AddWorktreeArgs(repoPath, worktreeName)...)
}
diff --git a/internal/git/gittest/repository_suite.go b/internal/git/gittest/repository_suite.go
index f689287e3..8ea6e52c9 100644
--- a/internal/git/gittest/repository_suite.go
+++ b/internal/git/gittest/repository_suite.go
@@ -35,7 +35,7 @@ func testRepositoryResolveRevision(t *testing.T, getRepository func(testing.TB,
ctx, cancel := testhelper.Context()
defer cancel()
- pbRepo, _, clean := testhelper.NewTestRepo(t)
+ pbRepo, _, clean := CloneRepo(t)
defer clean()
for _, tc := range []struct {
@@ -89,7 +89,7 @@ func testRepositoryHasBranches(t *testing.T, getRepository func(testing.TB, *git
ctx, cancel := testhelper.Context()
defer cancel()
- pbRepo, repoPath, clean := testhelper.InitBareRepo(t)
+ pbRepo, repoPath, clean := InitBareRepo(t)
defer clean()
repo := getRepository(t, pbRepo)
diff --git a/internal/git/housekeeping/housekeeping_test.go b/internal/git/housekeeping/housekeeping_test.go
index c713a3717..0dbc1c045 100644
--- a/internal/git/housekeeping/housekeeping_test.go
+++ b/internal/git/housekeeping/housekeeping_test.go
@@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
)
@@ -327,7 +328,7 @@ func testPerformWithSpecificFile(t *testing.T, file string, finder staleFileFind
ctx, cancel := testhelper.Context()
defer cancel()
- _, repoPath, cleanup := testhelper.NewTestRepo(t)
+ _, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
for _, tc := range []struct {
diff --git a/internal/git/localrepo/config_test.go b/internal/git/localrepo/config_test.go
index 7a10aaf19..7e3884abb 100644
--- a/internal/git/localrepo/config_test.go
+++ b/internal/git/localrepo/config_test.go
@@ -9,13 +9,14 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/helper/text"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
)
func TestRepo_Config(t *testing.T) {
- bareRepo, _, cleanup := testhelper.InitBareRepo(t)
+ bareRepo, _, cleanup := gittest.InitBareRepo(t)
defer cleanup()
repo := New(nil, bareRepo, config.Cfg{})
@@ -46,7 +47,7 @@ func TestBuildConfigAddOptsFlags(t *testing.T) {
}
func TestConfig_Add(t *testing.T) {
- repoProto, repoPath, cleanup := testhelper.InitBareRepo(t)
+ repoProto, repoPath, cleanup := gittest.InitBareRepo(t)
defer cleanup()
repo := New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -145,7 +146,7 @@ func TestBuildConfigGetRegexpOptsFlags(t *testing.T) {
}
func TestConfig_GetRegexp(t *testing.T) {
- repoProto, repoPath, cleanup := testhelper.InitBareRepo(t)
+ repoProto, repoPath, cleanup := gittest.InitBareRepo(t)
defer cleanup()
repo := New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -256,7 +257,7 @@ func TestConfig_UnsetAll(t *testing.T) {
}
}
- repoProto, repoPath, cleanup := testhelper.InitBareRepo(t)
+ repoProto, repoPath, cleanup := gittest.InitBareRepo(t)
defer cleanup()
repo := New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
diff --git a/internal/git/localrepo/objects_test.go b/internal/git/localrepo/objects_test.go
index b15d598c1..df46aa722 100644
--- a/internal/git/localrepo/objects_test.go
+++ b/internal/git/localrepo/objects_test.go
@@ -14,6 +14,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/helper/text"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -28,7 +29,7 @@ func TestRepo_WriteBlob(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- pbRepo, repoPath, clean := testhelper.InitBareRepo(t)
+ pbRepo, repoPath, clean := gittest.InitBareRepo(t)
defer clean()
repo := New(git.NewExecCommandFactory(config.Config), pbRepo, config.Config)
@@ -154,7 +155,7 @@ func TestRepo_WriteTag(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- pbRepo, repoPath, clean := testhelper.NewTestRepo(t)
+ pbRepo, repoPath, clean := gittest.CloneRepo(t)
defer clean()
repo := New(git.NewExecCommandFactory(config.Config), pbRepo, config.Config)
@@ -205,7 +206,7 @@ func TestRepo_ReadObject(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := New(git.NewExecCommandFactory(config.Config), testRepo, config.Config)
@@ -240,7 +241,7 @@ func TestRepo_ReadCommit(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- repoProto, _, cleanup := testhelper.NewTestRepo(t)
+ repoProto, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
diff --git a/internal/git/localrepo/refs_test.go b/internal/git/localrepo/refs_test.go
index ccf8667b5..42962793a 100644
--- a/internal/git/localrepo/refs_test.go
+++ b/internal/git/localrepo/refs_test.go
@@ -5,6 +5,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
)
@@ -18,7 +19,7 @@ func TestRepo_ContainsRef(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := New(git.NewExecCommandFactory(config.Config), testRepo, config.Config)
@@ -58,7 +59,7 @@ func TestRepo_GetReference(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := New(git.NewExecCommandFactory(config.Config), testRepo, config.Config)
@@ -115,7 +116,7 @@ func TestRepo_GetReferenceWithAmbiguousRefs(t *testing.T) {
}(config.Config.Ruby.Dir)
config.Config.Ruby.Dir = "/var/empty"
- repoProto, _, cleanup := testhelper.NewTestRepo(t)
+ repoProto, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -150,7 +151,7 @@ func TestRepo_GetReferences(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := New(git.NewExecCommandFactory(config.Config), testRepo, config.Config)
@@ -205,7 +206,7 @@ func TestRepo_GetBranches(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := New(git.NewExecCommandFactory(config.Config), testRepo, config.Config)
@@ -219,7 +220,7 @@ func TestRepo_UpdateRef(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
defer func(oldValue string) {
@@ -327,7 +328,7 @@ func TestRepo_UpdateRef(t *testing.T) {
for _, tc := range testcases {
t.Run(tc.desc, func(t *testing.T) {
// Re-create repo for each testcase.
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := New(gitCmdFactory, testRepo, config.Config)
diff --git a/internal/git/localrepo/remote_test.go b/internal/git/localrepo/remote_test.go
index a760fd71e..5e4cd31b5 100644
--- a/internal/git/localrepo/remote_test.go
+++ b/internal/git/localrepo/remote_test.go
@@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/helper/text"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -70,11 +71,11 @@ func TestRemote_Add(t *testing.T) {
}(config.Config.Ruby.Dir)
config.Config.Ruby.Dir = "/var/empty"
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
- _, remoteRepoPath, cleanup := testhelper.NewTestRepo(t)
+ _, remoteRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
testhelper.MustRunCommand(t, nil, "git", "-C", repoPath, "remote", "remove", "origin")
@@ -148,7 +149,7 @@ func TestRemote_Add(t *testing.T) {
}
func TestRemote_Remove(t *testing.T) {
- repoProto, repoPath, cleanup := testhelper.InitBareRepo(t)
+ repoProto, repoPath, cleanup := gittest.InitBareRepo(t)
defer cleanup()
repo := New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -182,7 +183,7 @@ func TestRemote_Remove(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- repoProto, _, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
remote := New(git.NewExecCommandFactory(config.Config), repoProto, config.Config).Remote()
@@ -205,7 +206,7 @@ func TestRemote_Remove(t *testing.T) {
}
func TestRemote_Exists(t *testing.T) {
- repoProto, _, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
remote := New(git.NewExecCommandFactory(config.Config), repoProto, config.Config).Remote()
@@ -244,7 +245,7 @@ func TestBuildSetURLOptsFlags(t *testing.T) {
}
func TestRemote_SetURL(t *testing.T) {
- repoProto, repoPath, cleanup := testhelper.InitBareRepo(t)
+ repoProto, repoPath, cleanup := gittest.InitBareRepo(t)
defer cleanup()
repo := New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -312,13 +313,13 @@ func TestRepo_FetchRemote(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- _, remoteRepoPath, cleanup := testhelper.NewTestRepo(t)
+ _, remoteRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
initBareWithRemote := func(t *testing.T, remote string) (*Repo, string, testhelper.Cleanup) {
t.Helper()
- testRepo, testRepoPath, cleanup := testhelper.InitBareRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.InitBareRepo(t)
cmd := exec.Command(config.Config.Git.BinPath, "-C", testRepoPath, "remote", "add", remote, remoteRepoPath)
err := cmd.Run()
@@ -340,7 +341,7 @@ func TestRepo_FetchRemote(t *testing.T) {
})
t.Run("unknown remote", func(t *testing.T) {
- testRepo, _, cleanup := testhelper.InitBareRepo(t)
+ testRepo, _, cleanup := gittest.InitBareRepo(t)
defer cleanup()
repo := New(gitCmdFactory, testRepo, config.Config)
@@ -372,10 +373,10 @@ func TestRepo_FetchRemote(t *testing.T) {
})
t.Run("with env", func(t *testing.T) {
- _, sourceRepoPath, sourceCleanup := testhelper.NewTestRepo(t)
+ _, sourceRepoPath, sourceCleanup := gittest.CloneRepo(t)
defer sourceCleanup()
- testRepo, testRepoPath, testCleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, testCleanup := gittest.CloneRepo(t)
defer testCleanup()
repo := New(gitCmdFactory, testRepo, config.Config)
@@ -387,10 +388,10 @@ func TestRepo_FetchRemote(t *testing.T) {
})
t.Run("with globals", func(t *testing.T) {
- _, sourceRepoPath, sourceCleanup := testhelper.NewTestRepo(t)
+ _, sourceRepoPath, sourceCleanup := gittest.CloneRepo(t)
defer sourceCleanup()
- testRepo, testRepoPath, testCleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, testCleanup := gittest.CloneRepo(t)
defer testCleanup()
repo := New(gitCmdFactory, testRepo, config.Config)
@@ -415,10 +416,10 @@ func TestRepo_FetchRemote(t *testing.T) {
})
t.Run("with prune", func(t *testing.T) {
- _, sourceRepoPath, sourceCleanup := testhelper.NewTestRepo(t)
+ _, sourceRepoPath, sourceCleanup := gittest.CloneRepo(t)
defer sourceCleanup()
- testRepo, testRepoPath, testCleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, testCleanup := gittest.CloneRepo(t)
defer testCleanup()
repo := New(gitCmdFactory, testRepo, config.Config)
diff --git a/internal/git/log/commit_test.go b/internal/git/log/commit_test.go
index aa616e99c..2f86e96db 100644
--- a/internal/git/log/commit_test.go
+++ b/internal/git/log/commit_test.go
@@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
"gitlab.com/gitlab-org/gitaly/internal/git/catfile"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -124,7 +125,7 @@ func TestGetCommitCatfile(t *testing.T) {
ctx = metadata.NewIncomingContext(ctx, metadata.MD{})
defer cancel()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
const commitSha = "2d1db523e11e777e49377cfb22d368deec3f0793"
@@ -173,7 +174,7 @@ func TestGetCommitCatfileWithTrailers(t *testing.T) {
ctx = metadata.NewIncomingContext(ctx, metadata.MD{})
defer cancel()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
gitCmdFactory := git.NewExecCommandFactory(config.Config)
diff --git a/internal/git/log/tag_test.go b/internal/git/log/tag_test.go
index 29121ecec..0165d79db 100644
--- a/internal/git/log/tag_test.go
+++ b/internal/git/log/tag_test.go
@@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
"gitlab.com/gitlab-org/gitaly/internal/git/catfile"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/helper"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -19,7 +20,7 @@ func TestGetTag(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
testCases := []struct {
diff --git a/internal/git/objectpool/clone_test.go b/internal/git/objectpool/clone_test.go
index 4a206f0f0..623a0810a 100644
--- a/internal/git/objectpool/clone_test.go
+++ b/internal/git/objectpool/clone_test.go
@@ -6,6 +6,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
)
@@ -14,10 +15,10 @@ func TestClone(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), testRepo.GetStorageName(), testhelper.NewTestObjectPoolName(t))
+ pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), testRepo.GetStorageName(), gittest.NewObjectPoolName(t))
require.NoError(t, err)
err = pool.clone(ctx, testRepo)
@@ -32,10 +33,10 @@ func TestCloneExistingPool(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), testRepo.GetStorageName(), testhelper.NewTestObjectPoolName(t))
+ pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), testRepo.GetStorageName(), gittest.NewObjectPoolName(t))
require.NoError(t, err)
err = pool.clone(ctx, testRepo)
diff --git a/internal/git/objectpool/fetch_test.go b/internal/git/objectpool/fetch_test.go
index 9e408505b..875a8ab27 100644
--- a/internal/git/objectpool/fetch_test.go
+++ b/internal/git/objectpool/fetch_test.go
@@ -16,10 +16,10 @@ import (
)
func TestFetchFromOriginDangling(t *testing.T) {
- source, _, cleanup := testhelper.NewTestRepo(t)
+ source, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
- pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), source.StorageName, testhelper.NewTestObjectPoolName(t))
+ pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), source.StorageName, gittest.NewObjectPoolName(t))
require.NoError(t, err)
ctx, cancel := testhelper.Context()
@@ -88,10 +88,10 @@ func TestFetchFromOriginDangling(t *testing.T) {
}
func TestFetchFromOriginDeltaIslands(t *testing.T) {
- source, sourcePath, cleanup := testhelper.NewTestRepo(t)
+ source, sourcePath, cleanup := gittest.CloneRepo(t)
defer cleanup()
- pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), source.StorageName, testhelper.NewTestObjectPoolName(t))
+ pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), source.StorageName, gittest.NewObjectPoolName(t))
require.NoError(t, err)
ctx, cancel := testhelper.Context()
@@ -114,10 +114,10 @@ func TestFetchFromOriginDeltaIslands(t *testing.T) {
}
func TestFetchFromOriginBitmapHashCache(t *testing.T) {
- source, _, cleanup := testhelper.NewTestRepo(t)
+ source, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
- pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), source.StorageName, testhelper.NewTestObjectPoolName(t))
+ pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), source.StorageName, gittest.NewObjectPoolName(t))
require.NoError(t, err)
ctx, cancel := testhelper.Context()
@@ -143,10 +143,10 @@ func TestFetchFromOriginBitmapHashCache(t *testing.T) {
}
func TestFetchFromOriginRefUpdates(t *testing.T) {
- source, sourcePath, cleanup := testhelper.NewTestRepo(t)
+ source, sourcePath, cleanup := gittest.CloneRepo(t)
defer cleanup()
- pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), source.StorageName, testhelper.NewTestObjectPoolName(t))
+ pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), source.StorageName, gittest.NewObjectPoolName(t))
require.NoError(t, err)
poolPath := pool.FullPath()
diff --git a/internal/git/objectpool/link_test.go b/internal/git/objectpool/link_test.go
index 644efc12b..c90a482ab 100644
--- a/internal/git/objectpool/link_test.go
+++ b/internal/git/objectpool/link_test.go
@@ -16,7 +16,7 @@ func TestLink(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
pool, poolCleanup := NewTestObjectPool(ctx, t, testRepo.GetStorageName())
@@ -53,7 +53,7 @@ func TestLinkRemoveBitmap(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
pool, poolCleanup := NewTestObjectPool(ctx, t, testRepo.GetStorageName())
@@ -101,7 +101,7 @@ func TestUnlink(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
pool, poolCleanup := NewTestObjectPool(ctx, t, testRepo.GetStorageName())
@@ -122,7 +122,7 @@ func TestLinkAbsoluteLinkExists(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
pool, poolCleanup := NewTestObjectPool(ctx, t, testRepo.GetStorageName())
diff --git a/internal/git/objectpool/pool_test.go b/internal/git/objectpool/pool_test.go
index 2e837a536..49e7dcf59 100644
--- a/internal/git/objectpool/pool_test.go
+++ b/internal/git/objectpool/pool_test.go
@@ -10,24 +10,25 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
)
func TestNewObjectPool(t *testing.T) {
- _, err := NewObjectPool(config.Config, config.NewLocator(config.Config), nil, "default", testhelper.NewTestObjectPoolName(t))
+ _, err := NewObjectPool(config.Config, config.NewLocator(config.Config), nil, "default", gittest.NewObjectPoolName(t))
require.NoError(t, err)
- _, err = NewObjectPool(config.Config, config.NewLocator(config.Config), nil, "mepmep", testhelper.NewTestObjectPoolName(t))
+ _, err = NewObjectPool(config.Config, config.NewLocator(config.Config), nil, "mepmep", gittest.NewObjectPoolName(t))
require.Error(t, err, "creating pool in storage that does not exist should fail")
}
func TestNewFromRepoSuccess(t *testing.T) {
ctx, cancel := testhelper.Context()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
- relativePoolPath := testhelper.NewTestObjectPoolName(t)
+ relativePoolPath := gittest.NewObjectPoolName(t)
gitCmdFactory := git.NewExecCommandFactory(config.Config)
pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), gitCmdFactory, testRepo.GetStorageName(), relativePoolPath)
@@ -45,7 +46,7 @@ func TestNewFromRepoSuccess(t *testing.T) {
}
func TestNewFromRepoNoObjectPool(t *testing.T) {
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
gitCmdFactory := git.NewExecCommandFactory(config.Config)
@@ -96,12 +97,12 @@ func TestCreate(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
masterSha := testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "show-ref", "master")
gitCmdFactory := git.NewExecCommandFactory(config.Config)
- pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), gitCmdFactory, testRepo.GetStorageName(), testhelper.NewTestObjectPoolName(t))
+ pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), gitCmdFactory, testRepo.GetStorageName(), gittest.NewObjectPoolName(t))
require.NoError(t, err)
err = pool.Create(ctx, testRepo)
@@ -131,10 +132,10 @@ func TestCreateSubDirsExist(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), testRepo.GetStorageName(), testhelper.NewTestObjectPoolName(t))
+ pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), testRepo.GetStorageName(), gittest.NewObjectPoolName(t))
defer pool.Remove(ctx)
require.NoError(t, err)
@@ -152,10 +153,10 @@ func TestRemove(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), testRepo.GetStorageName(), testhelper.NewTestObjectPoolName(t))
+ pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), testRepo.GetStorageName(), gittest.NewObjectPoolName(t))
require.NoError(t, err)
err = pool.Create(ctx, testRepo)
diff --git a/internal/git/objectpool/testhelper_test.go b/internal/git/objectpool/testhelper_test.go
index 4ef2d1a29..c917a5fb9 100644
--- a/internal/git/objectpool/testhelper_test.go
+++ b/internal/git/objectpool/testhelper_test.go
@@ -7,6 +7,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/hooks"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -25,7 +26,7 @@ func testMain(m *testing.M) int {
}
func NewTestObjectPool(ctx context.Context, t *testing.T, storageName string) (*ObjectPool, func()) {
- pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), storageName, testhelper.NewTestObjectPoolName(t))
+ pool, err := NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), storageName, gittest.NewObjectPoolName(t))
require.NoError(t, err)
return pool, func() {
require.NoError(t, pool.Remove(ctx))
diff --git a/internal/git/stats/analyzehttp_test.go b/internal/git/stats/analyzehttp_test.go
index 25f09aa65..202f188c3 100644
--- a/internal/git/stats/analyzehttp_test.go
+++ b/internal/git/stats/analyzehttp_test.go
@@ -17,7 +17,7 @@ func TestClone(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- _, repoPath, cleanup := testhelper.NewTestRepo(t)
+ _, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
serverPort, stopGitServer := gittest.GitServer(t, config.Config, repoPath, nil)
@@ -76,7 +76,7 @@ func TestCloneWithAuth(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- _, repoPath, cleanup := testhelper.NewTestRepo(t)
+ _, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
const (
diff --git a/internal/git/stats/git_test.go b/internal/git/stats/git_test.go
index 8f49dc969..f1306785c 100644
--- a/internal/git/stats/git_test.go
+++ b/internal/git/stats/git_test.go
@@ -13,16 +13,17 @@ import (
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
)
func TestLogObjectInfo(t *testing.T) {
- repo1, repoPath1, cleanup1 := testhelper.NewTestRepo(t)
+ repo1, repoPath1, cleanup1 := gittest.CloneRepo(t)
defer cleanup1()
- repo2, repoPath2, cleanup2 := testhelper.NewTestRepo(t)
+ repo2, repoPath2, cleanup2 := gittest.CloneRepo(t)
defer cleanup2()
ctx, cancel := testhelper.Context()
diff --git a/internal/git/stats/profile_test.go b/internal/git/stats/profile_test.go
index 456da8560..65a76d2ad 100644
--- a/internal/git/stats/profile_test.go
+++ b/internal/git/stats/profile_test.go
@@ -14,7 +14,7 @@ import (
)
func TestRepositoryProfile(t *testing.T) {
- testRepo, testRepoPath, cleanup := testhelper.InitBareRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.InitBareRepo(t)
defer cleanup()
ctx, cancel := testhelper.Context()
diff --git a/internal/git/updateref/updateref_test.go b/internal/git/updateref/updateref_test.go
index 45e869c63..3c755337b 100644
--- a/internal/git/updateref/updateref_test.go
+++ b/internal/git/updateref/updateref_test.go
@@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/hooks"
"gitlab.com/gitlab-org/gitaly/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
@@ -29,7 +30,7 @@ func testMain(m *testing.M) int {
func setup(t *testing.T, cfg config.Cfg) (context.Context, *localrepo.Repo, string, func()) {
ctx, cancel := testhelper.Context()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
teardown := func() {
cancel()
cleanup()
diff --git a/internal/git2go/apply_test.go b/internal/git2go/apply_test.go
index 6ff28c3d5..e3ed37d8c 100644
--- a/internal/git2go/apply_test.go
+++ b/internal/git2go/apply_test.go
@@ -16,7 +16,7 @@ import (
)
func TestExecutor_Apply(t *testing.T) {
- pbRepo, repoPath, clean := testhelper.InitBareRepo(t)
+ pbRepo, repoPath, clean := gittest.InitBareRepo(t)
defer clean()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), pbRepo, config.Config)
diff --git a/internal/git2go/commit_test.go b/internal/git2go/commit_test.go
index 6a30f071f..6e689a314 100644
--- a/internal/git2go/commit_test.go
+++ b/internal/git2go/commit_test.go
@@ -54,7 +54,7 @@ func TestExecutor_Commit(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- pbRepo, repoPath, clean := testhelper.InitBareRepo(t)
+ pbRepo, repoPath, clean := gittest.InitBareRepo(t)
defer clean()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), pbRepo, config.Config)
diff --git a/internal/gitaly/hook/access_test.go b/internal/gitaly/hook/access_test.go
index bd3f27132..4d68e592f 100644
--- a/internal/gitaly/hook/access_test.go
+++ b/internal/gitaly/hook/access_test.go
@@ -10,6 +10,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -30,7 +31,7 @@ func TestAccess_verifyParams(t *testing.T) {
secretToken := "topsecret"
glID, glRepository := "key-123", "repo-1"
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
changes := "changes1\nchanges2\nchanges3"
protocol := "protocol"
@@ -133,7 +134,7 @@ func TestAccess_escapedAndRelativeURLs(t *testing.T) {
secretToken := "topsecret"
glID, glRepository := "key-123", "repo-1"
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
changes := "changes1\nchanges2\nchanges3"
protocol := "protocol"
@@ -233,7 +234,7 @@ func TestAccess_escapedAndRelativeURLs(t *testing.T) {
}
func TestAccess_allowedResponseHandling(t *testing.T) {
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
// set git quarantine directories
gitObjectDir := filepath.Join(testRepoPath, "quarantine", "object", "dir")
diff --git a/internal/gitaly/hook/custom_test.go b/internal/gitaly/hook/custom_test.go
index 069daecea..0050124f9 100644
--- a/internal/gitaly/hook/custom_test.go
+++ b/internal/gitaly/hook/custom_test.go
@@ -12,6 +12,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/helper/text"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -49,7 +50,7 @@ echo "$0"
exit 0`)
func TestCustomHooksSuccess(t *testing.T) {
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
testCases := []struct {
@@ -100,7 +101,7 @@ func TestCustomHooksSuccess(t *testing.T) {
}
func TestCustomHookPartialFailure(t *testing.T) {
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
globalCustomHooksDir, cleanup := testhelper.TempDir(t)
@@ -176,7 +177,7 @@ func TestCustomHookPartialFailure(t *testing.T) {
}
func TestCustomHooksMultipleHooks(t *testing.T) {
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
globalCustomHooksDir, cleanup := testhelper.TempDir(t)
@@ -226,7 +227,7 @@ func TestCustomHooksMultipleHooks(t *testing.T) {
}
func TestCustomHooksWithSymlinks(t *testing.T) {
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
globalCustomHooksDir, cleanup := testhelper.TempDir(t)
@@ -297,7 +298,7 @@ func TestCustomHooksWithSymlinks(t *testing.T) {
}
func TestMultilineStdin(t *testing.T) {
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
globalCustomHooksDir, cleanup := testhelper.TempDir(t)
@@ -331,7 +332,7 @@ old3 new3 ref3
}
func TestMultipleScriptsStdin(t *testing.T) {
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
globalCustomHooksDir, cleanup := testhelper.TempDir(t)
diff --git a/internal/gitaly/hook/postreceive_test.go b/internal/gitaly/hook/postreceive_test.go
index 93a22bc58..028f22d71 100644
--- a/internal/gitaly/hook/postreceive_test.go
+++ b/internal/gitaly/hook/postreceive_test.go
@@ -60,7 +60,7 @@ func TestPrintAlert(t *testing.T) {
}
func TestPostReceive_customHook(t *testing.T) {
- repo, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repo, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
hookManager := NewManager(config.NewLocator(config.Config), transaction.NewManager(config.Config), GitlabAPIStub, config.Config)
@@ -242,7 +242,7 @@ func (m *postreceiveAPIMock) PostReceive(ctx context.Context, glRepository, glID
}
func TestPostReceive_gitlab(t *testing.T) {
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
payload, err := git.NewHooksPayload(config.Config, testRepo, nil, nil, &git.ReceiveHooksPayload{
diff --git a/internal/gitaly/hook/prereceive_test.go b/internal/gitaly/hook/prereceive_test.go
index 02793fc2c..9665996f4 100644
--- a/internal/gitaly/hook/prereceive_test.go
+++ b/internal/gitaly/hook/prereceive_test.go
@@ -19,7 +19,7 @@ import (
)
func TestPrereceive_customHooks(t *testing.T) {
- repo, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repo, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
hookManager := NewManager(config.NewLocator(config.Config), transaction.NewManager(config.Config), GitlabAPIStub, config.Config)
@@ -204,7 +204,7 @@ func (m *prereceiveAPIMock) PostReceive(context.Context, string, string, string,
}
func TestPrereceive_gitlab(t *testing.T) {
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
payload, err := git.NewHooksPayload(config.Config, testRepo, nil, nil, &git.ReceiveHooksPayload{
diff --git a/internal/gitaly/hook/transactions_test.go b/internal/gitaly/hook/transactions_test.go
index dcaa7c21e..65690e5dc 100644
--- a/internal/gitaly/hook/transactions_test.go
+++ b/internal/gitaly/hook/transactions_test.go
@@ -40,7 +40,7 @@ func TestHookManager_stopCalled(t *testing.T) {
Token: "foo",
}
- repo, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repo, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
var mockTxMgr mockTransactionManager
@@ -137,7 +137,7 @@ func TestHookManager_contextCancellationCancelsVote(t *testing.T) {
hookManager := NewManager(config.NewLocator(config.Config), &mockTxMgr, GitlabAPIStub, config.Config)
- repo, _, cleanup := testhelper.NewTestRepo(t)
+ repo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
hooksPayload, err := git.NewHooksPayload(
diff --git a/internal/gitaly/hook/update_test.go b/internal/gitaly/hook/update_test.go
index d3d21de09..f67bb68cd 100644
--- a/internal/gitaly/hook/update_test.go
+++ b/internal/gitaly/hook/update_test.go
@@ -16,7 +16,7 @@ import (
)
func TestUpdate_customHooks(t *testing.T) {
- repo, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repo, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
hookManager := NewManager(config.NewLocator(config.Config), transaction.NewManager(config.Config), GitlabAPIStub, config.Config)
diff --git a/internal/gitaly/rubyserver/proxy_test.go b/internal/gitaly/rubyserver/proxy_test.go
index d21b006ca..3b0d92acc 100644
--- a/internal/gitaly/rubyserver/proxy_test.go
+++ b/internal/gitaly/rubyserver/proxy_test.go
@@ -4,6 +4,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"google.golang.org/grpc/metadata"
)
@@ -16,7 +17,7 @@ func TestSetHeadersBlocksUnknownMetadata(t *testing.T) {
otherValue := "test-value"
inCtx := metadata.NewIncomingContext(ctx, metadata.Pairs(otherKey, otherValue))
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
outCtx, err := SetHeaders(inCtx, testhelper.DefaultLocator(), testRepo)
@@ -37,7 +38,7 @@ func TestSetHeadersPreservesAllowlistedMetadata(t *testing.T) {
value := "test-value"
inCtx := metadata.NewIncomingContext(ctx, metadata.Pairs(key, value))
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
outCtx, err := SetHeaders(inCtx, testhelper.DefaultLocator(), testRepo)
@@ -57,7 +58,7 @@ func TestRubyFeatureHeaders(t *testing.T) {
value := "true"
inCtx := metadata.NewIncomingContext(ctx, metadata.Pairs(key, value))
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
outCtx, err := SetHeaders(inCtx, testhelper.DefaultLocator(), testRepo)
diff --git a/internal/gitaly/rubyserver/rubyserver_test.go b/internal/gitaly/rubyserver/rubyserver_test.go
index e6b96409e..a300f3ddb 100644
--- a/internal/gitaly/rubyserver/rubyserver_test.go
+++ b/internal/gitaly/rubyserver/rubyserver_test.go
@@ -7,6 +7,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/helper"
"gitlab.com/gitlab-org/gitaly/internal/storage"
@@ -34,7 +35,7 @@ func TestSetHeaders(t *testing.T) {
locator := testhelper.DefaultLocator()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
testCases := []struct {
diff --git a/internal/gitaly/server/auth_test.go b/internal/gitaly/server/auth_test.go
index 47f0b6cb5..c1a91a93a 100644
--- a/internal/gitaly/server/auth_test.go
+++ b/internal/gitaly/server/auth_test.go
@@ -328,7 +328,7 @@ func TestAuthBeforeLimit(t *testing.T) {
config.Config.Auth.Token = "abc123"
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
gitlabShellDir, cleanup := testhelper.TempDir(t)
diff --git a/internal/gitaly/service/blob/get_blob_test.go b/internal/gitaly/service/blob/get_blob_test.go
index fbad3fbc9..cfc9a9eab 100644
--- a/internal/gitaly/service/blob/get_blob_test.go
+++ b/internal/gitaly/service/blob/get_blob_test.go
@@ -7,6 +7,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/streamio"
@@ -16,7 +17,7 @@ func TestSuccessfulGetBlob(t *testing.T) {
stop, serverSocketPath := runBlobServer(t, testhelper.DefaultLocator())
defer stop()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
client, conn := newBlobClient(t, serverSocketPath)
@@ -96,7 +97,7 @@ func TestGetBlobNotFound(t *testing.T) {
client, conn := newBlobClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
request := &gitalypb.GetBlobRequest{
@@ -149,7 +150,7 @@ func TestFailedGetBlobRequestDueToValidationError(t *testing.T) {
stop, serverSocketPath := runBlobServer(t, testhelper.DefaultLocator())
defer stop()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
client, conn := newBlobClient(t, serverSocketPath)
diff --git a/internal/gitaly/service/blob/get_blobs_test.go b/internal/gitaly/service/blob/get_blobs_test.go
index 35eea1c5d..3ca713630 100644
--- a/internal/gitaly/service/blob/get_blobs_test.go
+++ b/internal/gitaly/service/blob/get_blobs_test.go
@@ -7,6 +7,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -16,7 +17,7 @@ func TestSuccessfulGetBlobsRequest(t *testing.T) {
stop, serverSocketPath := runBlobServer(t, testhelper.DefaultLocator())
defer stop()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
client, conn := newBlobClient(t, serverSocketPath)
@@ -136,7 +137,7 @@ func TestFailedGetBlobsRequestDueToValidation(t *testing.T) {
stop, serverSocketPath := runBlobServer(t, testhelper.DefaultLocator())
defer stop()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
client, conn := newBlobClient(t, serverSocketPath)
diff --git a/internal/gitaly/service/blob/lfs_pointers_test.go b/internal/gitaly/service/blob/lfs_pointers_test.go
index 5581a790d..02df2de9b 100644
--- a/internal/gitaly/service/blob/lfs_pointers_test.go
+++ b/internal/gitaly/service/blob/lfs_pointers_test.go
@@ -74,7 +74,7 @@ func testSuccessfulGetLFSPointersRequest(t *testing.T, ctx context.Context) {
stop, serverSocketPath := runBlobServer(t, testhelper.DefaultLocator())
defer stop()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
client, conn := newBlobClient(t, serverSocketPath)
@@ -129,7 +129,7 @@ func testFailedGetLFSPointersRequestDueToValidations(t *testing.T, ctx context.C
stop, serverSocketPath := runBlobServer(t, testhelper.DefaultLocator())
defer stop()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
client, conn := newBlobClient(t, serverSocketPath)
@@ -177,7 +177,7 @@ func TestSuccessfulGetNewLFSPointersRequest(t *testing.T) {
client, conn := newBlobClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
revision := []byte("46abbb087fcc0fd02c340f0f2f052bd2c7708da3")
@@ -318,7 +318,7 @@ func TestFailedGetNewLFSPointersRequestDueToValidations(t *testing.T) {
client, conn := newBlobClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -385,7 +385,7 @@ func testSuccessfulGetAllLFSPointersRequest(t *testing.T, ctx context.Context) {
client, conn := newBlobClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
request := &gitalypb.GetAllLFSPointersRequest{
@@ -485,7 +485,7 @@ func testGetAllLFSPointersVerifyScope(t *testing.T, ctx context.Context) {
client, conn := newBlobClient(t, serverSocketPath)
defer conn.Close()
- testRepo, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
request := &gitalypb.GetAllLFSPointersRequest{
@@ -518,7 +518,7 @@ func refHasPtr(t *testing.T, repoPath, ref string, lfsPtr *gitalypb.LFSPointer)
func TestFindLFSPointersByRevisions(t *testing.T) {
gitCmdFactory := git.NewExecCommandFactory(config.Config)
- repoProto, _, cleanup := testhelper.NewTestRepo(t)
+ repoProto, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(gitCmdFactory, repoProto, config.Config)
@@ -600,7 +600,7 @@ func TestFindLFSPointersByRevisions(t *testing.T) {
func TestReadLFSPointers(t *testing.T) {
gitCmdFactory := git.NewExecCommandFactory(config.Config)
- repoProto, _, cleanup := testhelper.NewTestRepo(t)
+ repoProto, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(gitCmdFactory, repoProto, config.Config)
diff --git a/internal/gitaly/service/cleanup/apply_bfg_object_map_stream_test.go b/internal/gitaly/service/cleanup/apply_bfg_object_map_stream_test.go
index ee1582781..4e9558b76 100644
--- a/internal/gitaly/service/cleanup/apply_bfg_object_map_stream_test.go
+++ b/internal/gitaly/service/cleanup/apply_bfg_object_map_stream_test.go
@@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -24,7 +25,7 @@ func TestApplyBfgObjectMapStreamSuccess(t *testing.T) {
client, conn := newCleanupServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), testRepo, config.Config)
@@ -111,7 +112,7 @@ func TestApplyBfgObjectMapStreamFailsOnInvalidInput(t *testing.T) {
client, conn := newCleanupServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
diff --git a/internal/gitaly/service/commit/between_test.go b/internal/gitaly/service/commit/between_test.go
index a016d4a82..d9218940c 100644
--- a/internal/gitaly/service/commit/between_test.go
+++ b/internal/gitaly/service/commit/between_test.go
@@ -4,6 +4,7 @@ import (
"io"
"testing"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -16,7 +17,7 @@ func TestSuccessfulCommitsBetween(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
from := []byte("498214de67004b1da3d820901307bed2a68a8ef6") // branch-merged
@@ -122,7 +123,7 @@ func TestFailedCommitsBetweenRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
invalidRepo := &gitalypb.Repository{StorageName: "fake", RelativePath: "path"}
diff --git a/internal/gitaly/service/commit/commit_messages_test.go b/internal/gitaly/service/commit/commit_messages_test.go
index 0ee1974e5..ae528135d 100644
--- a/internal/gitaly/service/commit/commit_messages_test.go
+++ b/internal/gitaly/service/commit/commit_messages_test.go
@@ -20,7 +20,7 @@ func TestSuccessfulGetCommitMessagesRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
diff --git a/internal/gitaly/service/commit/commit_signatures_test.go b/internal/gitaly/service/commit/commit_signatures_test.go
index 904088c06..dcd1edc3a 100644
--- a/internal/gitaly/service/commit/commit_signatures_test.go
+++ b/internal/gitaly/service/commit/commit_signatures_test.go
@@ -7,6 +7,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/helper/text"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -20,7 +21,7 @@ func TestSuccessfulGetCommitSignaturesRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
commitData := testhelper.MustReadFile(t, "testdata/dc00eb001f41dfac08192ead79c2377c588b82ee.commit")
@@ -83,7 +84,7 @@ func TestFailedGetCommitSignaturesRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
diff --git a/internal/gitaly/service/commit/commits_by_message_test.go b/internal/gitaly/service/commit/commits_by_message_test.go
index 38ca4c4f2..20de35e3a 100644
--- a/internal/gitaly/service/commit/commits_by_message_test.go
+++ b/internal/gitaly/service/commit/commits_by_message_test.go
@@ -6,6 +6,7 @@ import (
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -42,7 +43,7 @@ func TestSuccessfulCommitsByMessageRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
commits := []*gitalypb.GitCommit{
@@ -182,7 +183,7 @@ func TestFailedCommitsByMessageRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
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 3d840dc07..4e47fda34 100644
--- a/internal/gitaly/service/commit/count_commits_test.go
+++ b/internal/gitaly/service/commit/count_commits_test.go
@@ -7,6 +7,7 @@ import (
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -19,10 +20,10 @@ func TestSuccessfulCountCommitsRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo1, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo1, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- testRepo2, testRepo2Path, cleanupFn := testhelper.InitRepoWithWorktree(t)
+ testRepo2, testRepo2Path, cleanupFn := gittest.InitRepoWithWorktree(t)
defer cleanupFn()
committerName := "Scrooge McDuck"
@@ -190,7 +191,7 @@ func TestFailedCountCommitsRequestDueToValidationError(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
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 c22b26ce4..a8b740008 100644
--- a/internal/gitaly/service/commit/count_diverging_commits_test.go
+++ b/internal/gitaly/service/commit/count_diverging_commits_test.go
@@ -6,6 +6,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -24,7 +25,7 @@ func createRepoWithDivergentBranches(t *testing.T, leftCommits, rightCommits int
f h
*/
- repo, worktreePath, cleanupFn := testhelper.InitRepoWithWorktree(t)
+ repo, worktreePath, cleanupFn := gittest.InitRepoWithWorktree(t)
committerName := "Scrooge McDuck"
committerEmail := "scrooge@mcduck.com"
@@ -191,7 +192,7 @@ func TestFailedCountDivergentCommitsRequestDueToValidationError(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
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 877a58f5b..965462bc1 100644
--- a/internal/gitaly/service/commit/filter_shas_with_signatures_test.go
+++ b/internal/gitaly/service/commit/filter_shas_with_signatures_test.go
@@ -5,6 +5,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
)
@@ -19,7 +20,7 @@ func TestFilterShasWithSignaturesSuccessful(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
type testCase struct {
diff --git a/internal/gitaly/service/commit/find_all_commits_test.go b/internal/gitaly/service/commit/find_all_commits_test.go
index e92653c6e..a6eab0604 100644
--- a/internal/gitaly/service/commit/find_all_commits_test.go
+++ b/internal/gitaly/service/commit/find_all_commits_test.go
@@ -8,6 +8,7 @@ import (
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/service/ref"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -32,7 +33,7 @@ func TestSuccessfulFindAllCommitsRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
// Commits made on another branch in parallel to the normal commits below.
@@ -309,7 +310,7 @@ func TestFailedFindAllCommitsRequest(t *testing.T) {
invalidRepo := &gitalypb.Repository{StorageName: "fake", RelativePath: "path"}
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
diff --git a/internal/gitaly/service/commit/find_commit_test.go b/internal/gitaly/service/commit/find_commit_test.go
index b780b6579..5f19d8d20 100644
--- a/internal/gitaly/service/commit/find_commit_test.go
+++ b/internal/gitaly/service/commit/find_commit_test.go
@@ -31,7 +31,7 @@ func TestSuccessfulFindCommitRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -274,7 +274,7 @@ func TestFailedFindCommitRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
invalidRepo := &gitalypb.Repository{StorageName: "fake", RelativePath: "path"}
@@ -324,7 +324,7 @@ func benchmarkFindCommit(withCache bool, b *testing.B) {
client, conn := newCommitServiceClient(b, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(b)
+ testRepo, _, cleanupFn := gittest.CloneRepo(b)
defer cleanupFn()
// get a list of revisions
@@ -371,7 +371,7 @@ func TestFindCommitWithCache(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
// 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 52044bb7b..2a89f693f 100644
--- a/internal/gitaly/service/commit/find_commits_test.go
+++ b/internal/gitaly/service/commit/find_commits_test.go
@@ -28,7 +28,7 @@ func TestFindCommitsFields(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -191,7 +191,7 @@ func TestSuccessfulFindCommitsRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -458,7 +458,7 @@ func TestSuccessfulFindCommitsRequestWithAltGitObjectDirs(t *testing.T) {
committerName := "Scrooge McDuck"
committerEmail := "scrooge@mcduck.com"
- testRepoCopy, testRepoCopyPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ testRepoCopy, testRepoCopyPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
cmd := exec.Command(config.Config.Git.BinPath, "-C", testRepoCopyPath,
@@ -525,7 +525,7 @@ func TestSuccessfulFindCommitsRequestWithAmbiguousRef(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
// These are arbitrary SHAs in the repository. The important part is
@@ -571,7 +571,7 @@ func TestFailureFindCommitsRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -622,7 +622,7 @@ func TestFindCommitsRequestWithFollowAndOffset(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
request := &gitalypb.FindCommitsRequest{
diff --git a/internal/gitaly/service/commit/isancestor_test.go b/internal/gitaly/service/commit/isancestor_test.go
index a49061de1..8720b18e1 100644
--- a/internal/gitaly/service/commit/isancestor_test.go
+++ b/internal/gitaly/service/commit/isancestor_test.go
@@ -21,7 +21,7 @@ func TestCommitIsAncestorFailure(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
queries := []struct {
@@ -87,7 +87,7 @@ func TestCommitIsAncestorSuccess(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
queries := []struct {
@@ -187,7 +187,7 @@ func TestSuccessfulIsAncestorRequestWithAltGitObjectDirs(t *testing.T) {
committerName := "Scrooge McDuck"
committerEmail := "scrooge@mcduck.com"
- testRepoCopy, testRepoCopyPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ testRepoCopy, testRepoCopyPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
previousHead := testhelper.MustRunCommand(t, nil, "git", "-C", testRepoCopyPath, "show", "--format=format:%H", "--no-patch", "HEAD")
diff --git a/internal/gitaly/service/commit/languages_test.go b/internal/gitaly/service/commit/languages_test.go
index ce96393f7..0ec46d424 100644
--- a/internal/gitaly/service/commit/languages_test.go
+++ b/internal/gitaly/service/commit/languages_test.go
@@ -4,6 +4,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -16,7 +17,7 @@ func TestLanguages(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
request := &gitalypb.CommitLanguagesRequest{
@@ -57,7 +58,7 @@ func TestFileCountIsZeroWhenFeatureIsDisabled(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
request := &gitalypb.CommitLanguagesRequest{
@@ -93,7 +94,7 @@ func TestLanguagesEmptyRevision(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
request := &gitalypb.CommitLanguagesRequest{
@@ -123,7 +124,7 @@ func TestInvalidCommitLanguagesRequestRevision(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -143,7 +144,7 @@ func TestAmbiguousRefCommitLanguagesRequestRevision(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
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 9d1a520b8..1554f33cf 100644
--- a/internal/gitaly/service/commit/last_commit_for_path_test.go
+++ b/internal/gitaly/service/commit/last_commit_for_path_test.go
@@ -17,7 +17,7 @@ func TestSuccessfulLastCommitForPathRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
commit := testhelper.GitLabTestCommit("570e7b2abdd848b95f2f578043fc23bd6f6fd24d")
@@ -85,7 +85,7 @@ func TestFailedLastCommitForPathRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
invalidRepo := &gitalypb.Repository{StorageName: "fake", RelativePath: "path"}
@@ -136,7 +136,7 @@ func TestSuccessfulLastCommitWithGlobCharacters(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
// This is an arbitrary blob known to exist in the test repository
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 754a68c8d..65fc87759 100644
--- a/internal/gitaly/service/commit/list_commits_by_oid_test.go
+++ b/internal/gitaly/service/commit/list_commits_by_oid_test.go
@@ -5,6 +5,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
)
@@ -16,7 +17,7 @@ func TestSuccessfulListCommitsByOidRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
commits := []*gitalypb.GitCommit{
@@ -183,7 +184,7 @@ func TestSuccessfulListCommitsByOidLargeRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
req := &gitalypb.ListCommitsByOidRequest{
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 d876444fe..a5c94649c 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
@@ -5,6 +5,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
)
@@ -16,7 +17,7 @@ func TestSuccessfulListCommitsByRefNameRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -180,7 +181,7 @@ func TestSuccessfulListCommitsByRefNameLargeRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
refNames := [][]byte{}
diff --git a/internal/gitaly/service/commit/list_files_test.go b/internal/gitaly/service/commit/list_files_test.go
index 59d0a94fa..d8f64593b 100644
--- a/internal/gitaly/service/commit/list_files_test.go
+++ b/internal/gitaly/service/commit/list_files_test.go
@@ -7,6 +7,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/service/ref"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -54,7 +55,7 @@ func TestListFiles_success(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
tests := []struct {
@@ -146,7 +147,7 @@ func TestListFiles_unbornBranch(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.InitBareRepo(t)
+ testRepo, _, cleanupFn := gittest.InitBareRepo(t)
defer cleanupFn()
tests := []struct {
@@ -284,7 +285,7 @@ func TestListFiles_invalidRevision(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
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 645fff1bb..be31a4f2a 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
@@ -29,7 +29,7 @@ func TestSuccessfulListLastCommitsForTreeRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSockerPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -227,7 +227,7 @@ func TestFailedListLastCommitsForTreeRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
invalidRepo := &gitalypb.Repository{StorageName: "broken", RelativePath: "path"}
@@ -346,7 +346,7 @@ func TestNonUtf8ListLastCommitsForTreeRequest(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
// This is an arbitrary blob known to exist in the test repository
@@ -382,7 +382,7 @@ func TestSuccessfulListLastCommitsForTreeRequestWithGlobCharacters(t *testing.T)
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
path := ":wq"
diff --git a/internal/gitaly/service/commit/raw_blame_test.go b/internal/gitaly/service/commit/raw_blame_test.go
index 2c373cf5a..906b80974 100644
--- a/internal/gitaly/service/commit/raw_blame_test.go
+++ b/internal/gitaly/service/commit/raw_blame_test.go
@@ -6,6 +6,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/streamio"
@@ -19,7 +20,7 @@ func TestSuccessfulRawBlameRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -79,7 +80,7 @@ func TestFailedRawBlameRequest(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
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 b69046a12..74d852823 100644
--- a/internal/gitaly/service/commit/stats_test.go
+++ b/internal/gitaly/service/commit/stats_test.go
@@ -5,6 +5,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -20,7 +21,7 @@ func TestCommitStatsSuccess(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
tests := []struct {
@@ -91,7 +92,7 @@ func TestCommitStatsFailure(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
tests := []struct {
diff --git a/internal/gitaly/service/commit/tree_entries_test.go b/internal/gitaly/service/commit/tree_entries_test.go
index b3491d832..c1247886c 100644
--- a/internal/gitaly/service/commit/tree_entries_test.go
+++ b/internal/gitaly/service/commit/tree_entries_test.go
@@ -9,6 +9,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/helper/text"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -22,7 +23,7 @@ func TestSuccessfulGetTreeEntriesWithCurlyBraces(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
normalFolderName := "issue-46261/folder"
@@ -91,7 +92,7 @@ func TestSuccessfulGetTreeEntries(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rootEntries := []*gitalypb.TreeEntry{
@@ -415,7 +416,7 @@ func TestSuccessfulGetTreeEntries_FlatPathMaxDeep_SingleFoldersStructure(t *test
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
folderName := "1/2/3/4/5/6/7/8/9/10/11/12"
@@ -468,7 +469,7 @@ func TestFailedGetTreeEntriesRequestDueToValidationError(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
revision := []byte("d42783470dc29fde2cf459eb3199ee1d7e3f3a72")
diff --git a/internal/gitaly/service/commit/tree_entry_test.go b/internal/gitaly/service/commit/tree_entry_test.go
index 78e173990..380629b11 100644
--- a/internal/gitaly/service/commit/tree_entry_test.go
+++ b/internal/gitaly/service/commit/tree_entry_test.go
@@ -6,6 +6,7 @@ import (
"io"
"testing"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -26,7 +27,7 @@ func TestSuccessfulTreeEntry(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -179,7 +180,7 @@ func TestFailedTreeEntry(t *testing.T) {
client, conn := newCommitServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
revision := []byte("d42783470dc29fde2cf459eb3199ee1d7e3f3a72")
diff --git a/internal/gitaly/service/conflicts/list_conflict_files_test.go b/internal/gitaly/service/conflicts/list_conflict_files_test.go
index 92c05cd52..e7a14b116 100644
--- a/internal/gitaly/service/conflicts/list_conflict_files_test.go
+++ b/internal/gitaly/service/conflicts/list_conflict_files_test.go
@@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -32,7 +33,7 @@ func TestSuccessfulListConflictFilesRequest(t *testing.T) {
client, conn := NewConflictsClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ourCommitOid := "1a35b5a77cf6af7edf6703f88e82f6aff613666f"
@@ -106,7 +107,7 @@ func TestSuccessfulListConflictFilesRequestWithAncestor(t *testing.T) {
client, conn := NewConflictsClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ourCommitOid := "824be604a34828eb682305f0d963056cfac87b2d"
@@ -160,7 +161,7 @@ func TestListConflictFilesHugeDiff(t *testing.T) {
client, conn := NewConflictsClient(t, serverSocketPath)
defer conn.Close()
- repo, repoPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ repo, repoPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
our := buildCommit(t, ctx, repo, repoPath, map[string][]byte{
@@ -228,7 +229,7 @@ func TestListConflictFilesFailedPrecondition(t *testing.T) {
client, conn := NewConflictsClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -293,7 +294,7 @@ func TestFailedListConflictFilesRequestDueToValidation(t *testing.T) {
client, conn := NewConflictsClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ourCommitOid := "0b4bc9a49b562e85de7cc9e834518ea6828729b9"
diff --git a/internal/gitaly/service/conflicts/resolve_conflicts_test.go b/internal/gitaly/service/conflicts/resolve_conflicts_test.go
index 45471a994..6b2bf0e74 100644
--- a/internal/gitaly/service/conflicts/resolve_conflicts_test.go
+++ b/internal/gitaly/service/conflicts/resolve_conflicts_test.go
@@ -11,6 +11,7 @@ import (
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/service/conflicts"
@@ -65,7 +66,7 @@ func testSuccessfulResolveConflictsRequest(t *testing.T, ctx context.Context) {
client, conn := conflicts.NewConflictsClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), testRepo, config.Config)
@@ -205,7 +206,7 @@ func testResolveConflictsStableID(t *testing.T, ctx context.Context) {
client, conn := conflicts.NewConflictsClient(t, serverSocketPath)
defer conn.Close()
- repoProto, _, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -285,7 +286,7 @@ func testFailedResolveConflictsRequestDueToResolutionError(t *testing.T, ctx con
client, conn := conflicts.NewConflictsClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
mdGS := testhelper.GitalyServersMetadata(t, serverSocketPath)
@@ -354,7 +355,7 @@ func testFailedResolveConflictsRequestDueToValidation(t *testing.T, ctx context.
client, conn := conflicts.NewConflictsClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
mdGS := testhelper.GitalyServersMetadata(t, serverSocketPath)
diff --git a/internal/gitaly/service/diff/commit_test.go b/internal/gitaly/service/diff/commit_test.go
index 0a3fa024e..759d0c853 100644
--- a/internal/gitaly/service/diff/commit_test.go
+++ b/internal/gitaly/service/diff/commit_test.go
@@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/diff"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -21,7 +22,7 @@ func TestSuccessfulCommitDiffRequest(t *testing.T) {
client, conn := newDiffClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rightCommit := "ab2c9622c02288a2bbaaf35d96088cfdff31d9d9"
@@ -198,7 +199,7 @@ func TestSuccessfulCommitDiffRequestWithPaths(t *testing.T) {
client, conn := newDiffClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rightCommit := "e4003da16c1c2c3fc4567700121b17bf8e591c6c"
@@ -276,7 +277,7 @@ func TestSuccessfulCommitDiffRequestWithTypeChangeDiff(t *testing.T) {
client, conn := newDiffClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rightCommit := "184a47d38677e2e439964859b877ae9bc424ab11"
@@ -327,7 +328,7 @@ func TestSuccessfulCommitDiffRequestWithIgnoreWhitespaceChange(t *testing.T) {
client, conn := newDiffClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rightCommit := "e4003da16c1c2c3fc4567700121b17bf8e591c6c"
@@ -441,7 +442,7 @@ func TestSuccessfulCommitDiffRequestWithLimits(t *testing.T) {
client, conn := newDiffClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rightCommit := "899d3d27b04690ac1cd9ef4d8a74fde0667c57f1"
@@ -663,7 +664,7 @@ func TestFailedCommitDiffRequestDueToValidationError(t *testing.T) {
client, conn := newDiffClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rightCommit := "d42783470dc29fde2cf459eb3199ee1d7e3f3a72"
@@ -698,7 +699,7 @@ func TestFailedCommitDiffRequestWithNonExistentCommit(t *testing.T) {
client, conn := newDiffClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
nonExistentCommitID := "deadfacedeadfacedeadfacedeadfacedeadface"
@@ -723,7 +724,7 @@ func TestSuccessfulCommitDeltaRequest(t *testing.T) {
client, conn := newDiffClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rightCommit := "742518b2be68fc750bb4c357c0df821a88113286"
@@ -846,7 +847,7 @@ func TestSuccessfulCommitDeltaRequestWithPaths(t *testing.T) {
client, conn := newDiffClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rightCommit := "e4003da16c1c2c3fc4567700121b17bf8e591c6c"
@@ -915,7 +916,7 @@ func TestFailedCommitDeltaRequestDueToValidationError(t *testing.T) {
client, conn := newDiffClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rightCommit := "d42783470dc29fde2cf459eb3199ee1d7e3f3a72"
@@ -950,7 +951,7 @@ func TestFailedCommitDeltaRequestWithNonExistentCommit(t *testing.T) {
client, conn := newDiffClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
nonExistentCommitID := "deadfacedeadfacedeadfacedeadfacedeadface"
diff --git a/internal/gitaly/service/diff/find_changed_paths_test.go b/internal/gitaly/service/diff/find_changed_paths_test.go
index 06a47c5f4..ce5fe3e89 100644
--- a/internal/gitaly/service/diff/find_changed_paths_test.go
+++ b/internal/gitaly/service/diff/find_changed_paths_test.go
@@ -6,6 +6,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -19,7 +20,7 @@ func TestFindChangedPathsRequest_success(t *testing.T) {
client, conn := newDiffClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -126,7 +127,7 @@ func TestFindChangedPathsRequest_failing(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
tests := []struct {
diff --git a/internal/gitaly/service/diff/numstat_test.go b/internal/gitaly/service/diff/numstat_test.go
index 13f843210..32c565e61 100644
--- a/internal/gitaly/service/diff/numstat_test.go
+++ b/internal/gitaly/service/diff/numstat_test.go
@@ -5,6 +5,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/diff"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -18,7 +19,7 @@ func TestSuccessfulDiffStatsRequest(t *testing.T) {
client, conn := newDiffClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rightCommit := "e4003da16c1c2c3fc4567700121b17bf8e591c6c"
@@ -136,7 +137,7 @@ func TestFailedDiffStatsRequest(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
tests := []struct {
diff --git a/internal/gitaly/service/diff/raw_test.go b/internal/gitaly/service/diff/raw_test.go
index 02dbfc976..635046fa3 100644
--- a/internal/gitaly/service/diff/raw_test.go
+++ b/internal/gitaly/service/diff/raw_test.go
@@ -7,6 +7,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/streamio"
@@ -23,7 +24,7 @@ func TestSuccessfulRawDiffRequest(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rightCommit := "e395f646b1499e8e0279445fc99a0596a65fab7e"
@@ -33,7 +34,7 @@ func TestSuccessfulRawDiffRequest(t *testing.T) {
c, err := client.RawDiff(ctx, rpcRequest)
require.NoError(t, err)
- _, sandboxRepoPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ _, sandboxRepoPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
reader := streamio.NewReader(func() ([]byte, error) {
@@ -64,7 +65,7 @@ func TestFailedRawDiffRequestDueToValidations(t *testing.T) {
client, conn := newDiffClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -122,7 +123,7 @@ func TestSuccessfulRawPatchRequest(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rightCommit := "e395f646b1499e8e0279445fc99a0596a65fab7e"
@@ -137,7 +138,7 @@ func TestSuccessfulRawPatchRequest(t *testing.T) {
return response.GetData(), err
})
- _, sandboxRepoPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ _, sandboxRepoPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
testhelper.MustRunCommand(t, nil, "git", "-C", sandboxRepoPath, "reset", "--hard", leftCommit)
@@ -156,7 +157,7 @@ func TestFailedRawPatchRequestDueToValidations(t *testing.T) {
client, conn := newDiffClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -214,7 +215,7 @@ func TestRawPatchContainsGitLabSignature(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rightCommit := "e395f646b1499e8e0279445fc99a0596a65fab7e"
diff --git a/internal/gitaly/service/hook/pack_objects_test.go b/internal/gitaly/service/hook/pack_objects_test.go
index 1d7534042..b5daa1f4b 100644
--- a/internal/gitaly/service/hook/pack_objects_test.go
+++ b/internal/gitaly/service/hook/pack_objects_test.go
@@ -8,6 +8,7 @@ import (
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/test"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -18,7 +19,7 @@ func TestServer_PackObjectsHook_invalidArgument(t *testing.T) {
serverSocketPath, stop := runHooksServer(t, config.Config)
defer stop()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
client, conn := newHooksClient(t, serverSocketPath)
@@ -52,7 +53,7 @@ func TestServer_PackObjectsHook(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
diff --git a/internal/gitaly/service/hook/post_receive_test.go b/internal/gitaly/service/hook/post_receive_test.go
index 24adb9469..3581c6d08 100644
--- a/internal/gitaly/service/hook/post_receive_test.go
+++ b/internal/gitaly/service/hook/post_receive_test.go
@@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
gitalyhook "gitlab.com/gitlab-org/gitaly/internal/gitaly/hook"
"gitlab.com/gitlab-org/gitaly/internal/helper/text"
@@ -43,7 +44,7 @@ func TestHooksMissingStdin(t *testing.T) {
defer cleanup()
testhelper.WriteShellSecretFile(t, tempDir, secretToken)
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
c := testhelper.GitlabTestServerOptions{
@@ -191,7 +192,7 @@ To create a merge request for okay, visit:
},
}
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
secretToken := "secret token"
diff --git a/internal/gitaly/service/hook/pre_receive_test.go b/internal/gitaly/service/hook/pre_receive_test.go
index 7b6339834..cbca658c4 100644
--- a/internal/gitaly/service/hook/pre_receive_test.go
+++ b/internal/gitaly/service/hook/pre_receive_test.go
@@ -87,7 +87,7 @@ func TestPreReceiveHook_GitlabAPIAccess(t *testing.T) {
glID := "key-123"
changes := "changes123"
protocol := "http"
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
gitObjectDirRel := "git/object/dir"
@@ -194,7 +194,7 @@ func allowedHandler(allowed bool) http.HandlerFunc {
}
func TestPreReceive_APIErrors(t *testing.T) {
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -282,7 +282,7 @@ func TestPreReceive_APIErrors(t *testing.T) {
}
func TestPreReceiveHook_CustomHookErrors(t *testing.T) {
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
mux := http.NewServeMux()
@@ -415,7 +415,7 @@ func TestPreReceiveHook_Primary(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
mux := http.NewServeMux()
diff --git a/internal/gitaly/service/hook/reference_transaction_test.go b/internal/gitaly/service/hook/reference_transaction_test.go
index f105a7e1c..ef9743b17 100644
--- a/internal/gitaly/service/hook/reference_transaction_test.go
+++ b/internal/gitaly/service/hook/reference_transaction_test.go
@@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/helper"
"gitlab.com/gitlab-org/gitaly/internal/praefect/metadata"
@@ -125,7 +126,7 @@ func TestReferenceTransactionHook(t *testing.T) {
}, nil
}
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
serverSocketPath, stop := runHooksServer(t, config.Cfg{})
diff --git a/internal/gitaly/service/hook/update_test.go b/internal/gitaly/service/hook/update_test.go
index 796bd3ca9..48f1d2acb 100644
--- a/internal/gitaly/service/hook/update_test.go
+++ b/internal/gitaly/service/hook/update_test.go
@@ -39,7 +39,7 @@ func TestUpdate_CustomHooks(t *testing.T) {
serverSocketPath, stop := runHooksServer(t, config.Config)
defer stop()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
client, conn := newHooksClient(t, serverSocketPath)
diff --git a/internal/gitaly/service/internalgitaly/walkrepos_test.go b/internal/gitaly/service/internalgitaly/walkrepos_test.go
index 1a2919e91..ff4925174 100644
--- a/internal/gitaly/service/internalgitaly/walkrepos_test.go
+++ b/internal/gitaly/service/internalgitaly/walkrepos_test.go
@@ -8,6 +8,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -42,9 +43,9 @@ func TestWalkRepos(t *testing.T) {
// file walk happens lexicographically, so we delete repository in the middle
// of the seqeuence to ensure the walk proceeds normally
- testRepo1 := testhelper.NewTestRepoTo(t, storageRoot, "a")
- deletedRepo := testhelper.NewTestRepoTo(t, storageRoot, "b")
- testRepo2 := testhelper.NewTestRepoTo(t, storageRoot, "c")
+ testRepo1 := gittest.CloneRepoAtStorageRoot(t, storageRoot, "a")
+ deletedRepo := gittest.CloneRepoAtStorageRoot(t, storageRoot, "b")
+ testRepo2 := gittest.CloneRepoAtStorageRoot(t, storageRoot, "c")
// to test a directory being deleted during a walk, we must delete a directory after
// the file walk has started. To achieve that, we wrap the server to pass down a wrapped
diff --git a/internal/gitaly/service/objectpool/alternates_test.go b/internal/gitaly/service/objectpool/alternates_test.go
index 55a2d067a..0c5c1a58b 100644
--- a/internal/gitaly/service/objectpool/alternates_test.go
+++ b/internal/gitaly/service/objectpool/alternates_test.go
@@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/objectpool"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -25,11 +26,11 @@ func TestDisconnectGitAlternates(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
gitCmdFactory := git.NewExecCommandFactory(config.Config)
- pool, err := objectpool.NewObjectPool(config.Config, locator, gitCmdFactory, testRepo.GetStorageName(), testhelper.NewTestObjectPoolName(t))
+ pool, err := objectpool.NewObjectPool(config.Config, locator, gitCmdFactory, testRepo.GetStorageName(), gittest.NewObjectPoolName(t))
require.NoError(t, err)
defer pool.Remove(ctx)
@@ -76,7 +77,7 @@ func TestDisconnectGitAlternatesNoAlternates(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
altPath, err := locator.InfoAlternatesPath(testRepo)
@@ -111,7 +112,7 @@ func TestDisconnectGitAlternatesUnexpectedAlternates(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
altPath, err := locator.InfoAlternatesPath(testRepo)
@@ -133,7 +134,7 @@ func TestRemoveAlternatesIfOk(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
locator := config.NewLocator(config.Config)
diff --git a/internal/gitaly/service/objectpool/create_test.go b/internal/gitaly/service/objectpool/create_test.go
index ad866517a..22c5a81f5 100644
--- a/internal/gitaly/service/objectpool/create_test.go
+++ b/internal/gitaly/service/objectpool/create_test.go
@@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/objectpool"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -27,10 +28,10 @@ func TestCreate(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), "default", testhelper.NewTestObjectPoolName(t))
+ pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), "default", gittest.NewObjectPoolName(t))
require.NoError(t, err)
poolReq := &gitalypb.CreateObjectPoolRequest{
@@ -70,10 +71,10 @@ func TestUnsuccessfulCreate(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- validPoolPath := testhelper.NewTestObjectPoolName(t)
+ validPoolPath := gittest.NewObjectPoolName(t)
pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), "default", validPoolPath)
require.NoError(t, err)
defer pool.Remove(ctx)
@@ -170,10 +171,10 @@ func TestDelete(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- validPoolPath := testhelper.NewTestObjectPoolName(t)
+ validPoolPath := gittest.NewObjectPoolName(t)
pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), "default", validPoolPath)
require.NoError(t, err)
require.NoError(t, pool.Create(ctx, testRepo))
diff --git a/internal/gitaly/service/objectpool/fetch_into_object_pool_test.go b/internal/gitaly/service/objectpool/fetch_into_object_pool_test.go
index c3e928076..6be995e0c 100644
--- a/internal/gitaly/service/objectpool/fetch_into_object_pool_test.go
+++ b/internal/gitaly/service/objectpool/fetch_into_object_pool_test.go
@@ -36,12 +36,12 @@ func TestFetchIntoObjectPool_Success(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repoCommit := gittest.CreateCommit(t, testRepoPath, t.Name(), &gittest.CreateCommitOpts{Message: t.Name()})
- pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), "default", testhelper.NewTestObjectPoolName(t))
+ pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), "default", gittest.NewObjectPoolName(t))
require.NoError(t, err)
defer pool.Remove(ctx)
@@ -98,10 +98,10 @@ func TestFetchIntoObjectPool_hooksDisabled(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), "default", testhelper.NewTestObjectPoolName(t))
+ pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), "default", gittest.NewObjectPoolName(t))
require.NoError(t, err)
defer pool.Remove(ctx)
@@ -148,10 +148,10 @@ func TestFetchIntoObjectPool_CollectLogStatistics(t *testing.T) {
client, conn := newObjectPoolClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), "default", testhelper.NewTestObjectPoolName(t))
+ pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), "default", gittest.NewObjectPoolName(t))
require.NoError(t, err)
defer pool.Remove(ctx)
@@ -187,10 +187,10 @@ func TestFetchIntoObjectPool_Failure(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- pool, err := objectpool.NewObjectPool(config.Config, locator, gitCmdFactory, "default", testhelper.NewTestObjectPoolName(t))
+ pool, err := objectpool.NewObjectPool(config.Config, locator, gitCmdFactory, "default", gittest.NewObjectPoolName(t))
require.NoError(t, err)
defer pool.Remove(ctx)
diff --git a/internal/gitaly/service/objectpool/get_test.go b/internal/gitaly/service/objectpool/get_test.go
index a4fa92a00..ffa11230a 100644
--- a/internal/gitaly/service/objectpool/get_test.go
+++ b/internal/gitaly/service/objectpool/get_test.go
@@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/objectpool"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -22,10 +23,10 @@ func TestGetObjectPoolSuccess(t *testing.T) {
client, conn := newObjectPoolClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- relativePoolPath := testhelper.NewTestObjectPoolName(t)
+ relativePoolPath := gittest.NewObjectPoolName(t)
pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), testRepo.GetStorageName(), relativePoolPath)
require.NoError(t, err)
@@ -54,7 +55,7 @@ func TestGetObjectPoolNoFile(t *testing.T) {
client, conn := newObjectPoolClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -75,7 +76,7 @@ func TestGetObjectPoolBadFile(t *testing.T) {
client, conn := newObjectPoolClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
alternatesFilePath := filepath.Join(testRepoPath, "objects", "info", "alternates")
diff --git a/internal/gitaly/service/objectpool/link_test.go b/internal/gitaly/service/objectpool/link_test.go
index 20e44782e..b459a6f4e 100644
--- a/internal/gitaly/service/objectpool/link_test.go
+++ b/internal/gitaly/service/objectpool/link_test.go
@@ -29,11 +29,11 @@ func TestLink(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- repoProto, _, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
- pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), repoProto.GetStorageName(), testhelper.NewTestObjectPoolName(t))
+ pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), repoProto.GetStorageName(), gittest.NewObjectPoolName(t))
require.NoError(t, err)
require.NoError(t, pool.Remove(ctx), "make sure pool does not exist at start of test")
@@ -104,10 +104,10 @@ func TestLinkIdempotent(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), testRepo.GetStorageName(), testhelper.NewTestObjectPoolName(t))
+ pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), testRepo.GetStorageName(), gittest.NewObjectPoolName(t))
require.NoError(t, err)
defer pool.Remove(ctx)
require.NoError(t, pool.Create(ctx, testRepo))
@@ -135,10 +135,10 @@ func TestLinkNoClobber(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), testRepo.GetStorageName(), testhelper.NewTestObjectPoolName(t))
+ pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), testRepo.GetStorageName(), gittest.NewObjectPoolName(t))
require.NoError(t, err)
defer pool.Remove(ctx)
@@ -175,10 +175,10 @@ func TestLinkNoPool(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), testRepo.GetStorageName(), testhelper.NewTestObjectPoolName(t))
+ pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), testRepo.GetStorageName(), gittest.NewObjectPoolName(t))
require.NoError(t, err)
// intentionally do not call pool.Create
defer pool.Remove(ctx)
@@ -208,14 +208,14 @@ func TestUnlink(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- deletedRepo, deletedRepoPath, removeDeletedRepo := testhelper.NewTestRepo(t)
+ deletedRepo, deletedRepoPath, removeDeletedRepo := gittest.CloneRepo(t)
defer removeDeletedRepo()
gitCmdFactory := git.NewExecCommandFactory(config.Config)
- pool, err := objectpool.NewObjectPool(config.Config, locator, gitCmdFactory, testRepo.GetStorageName(), testhelper.NewTestObjectPoolName(t))
+ pool, err := objectpool.NewObjectPool(config.Config, locator, gitCmdFactory, testRepo.GetStorageName(), gittest.NewObjectPoolName(t))
require.NoError(t, err)
defer pool.Remove(ctx)
@@ -226,7 +226,7 @@ func TestUnlink(t *testing.T) {
removeDeletedRepo()
testhelper.AssertPathNotExists(t, deletedRepoPath)
- pool2, err := objectpool.NewObjectPool(config.Config, locator, gitCmdFactory, testRepo.GetStorageName(), testhelper.NewTestObjectPoolName(t))
+ pool2, err := objectpool.NewObjectPool(config.Config, locator, gitCmdFactory, testRepo.GetStorageName(), gittest.NewObjectPoolName(t))
require.NoError(t, err)
require.NoError(t, pool2.Create(ctx, testRepo), "create pool 2")
defer pool2.Remove(ctx)
@@ -286,7 +286,7 @@ func TestUnlink(t *testing.T) {
ObjectPool: &gitalypb.ObjectPool{
Repository: &gitalypb.Repository{
StorageName: testRepo.GetStorageName(),
- RelativePath: testhelper.NewTestObjectPoolName(t), // does not exist
+ RelativePath: gittest.NewObjectPoolName(t), // does not exist
},
},
},
@@ -322,10 +322,10 @@ func TestUnlinkIdempotent(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), testRepo.GetStorageName(), testhelper.NewTestObjectPoolName(t))
+ pool, err := objectpool.NewObjectPool(config.Config, locator, git.NewExecCommandFactory(config.Config), testRepo.GetStorageName(), gittest.NewObjectPoolName(t))
require.NoError(t, err)
defer pool.Remove(ctx)
require.NoError(t, pool.Create(ctx, testRepo))
diff --git a/internal/gitaly/service/objectpool/reduplicate_test.go b/internal/gitaly/service/objectpool/reduplicate_test.go
index 342343138..788145552 100644
--- a/internal/gitaly/service/objectpool/reduplicate_test.go
+++ b/internal/gitaly/service/objectpool/reduplicate_test.go
@@ -6,6 +6,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/objectpool"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -23,11 +24,11 @@ func TestReduplicate(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
gitCmdFactory := git.NewExecCommandFactory(config.Config)
- pool, err := objectpool.NewObjectPool(config.Config, locator, gitCmdFactory, testRepo.GetStorageName(), testhelper.NewTestObjectPoolName(t))
+ pool, err := objectpool.NewObjectPool(config.Config, locator, gitCmdFactory, testRepo.GetStorageName(), gittest.NewObjectPoolName(t))
require.NoError(t, err)
defer pool.Remove(ctx)
require.NoError(t, pool.Create(ctx, testRepo))
diff --git a/internal/gitaly/service/operations/apply_patch_test.go b/internal/gitaly/service/operations/apply_patch_test.go
index 7e6b47dda..9a16bda65 100644
--- a/internal/gitaly/service/operations/apply_patch_test.go
+++ b/internal/gitaly/service/operations/apply_patch_test.go
@@ -13,6 +13,7 @@ import (
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -35,7 +36,7 @@ func testSuccessfulUserApplyPatch(t *testing.T, ctx context.Context) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -147,7 +148,7 @@ func TestUserApplyPatch_stableID(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, _, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -213,7 +214,7 @@ func TestFailedPatchApplyPatch(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -236,7 +237,7 @@ func TestFailedPatchApplyPatch(t *testing.T) {
}
func TestFailedValidationUserApplyPatch(t *testing.T) {
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
diff --git a/internal/gitaly/service/operations/branches_test.go b/internal/gitaly/service/operations/branches_test.go
index 9ca0204e9..5a51dc4c3 100644
--- a/internal/gitaly/service/operations/branches_test.go
+++ b/internal/gitaly/service/operations/branches_test.go
@@ -40,7 +40,7 @@ func TestSuccessfulCreateBranchRequest(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -123,7 +123,7 @@ func TestSuccessfulCreateBranchRequest(t *testing.T) {
}
func TestUserCreateBranchWithTransaction(t *testing.T) {
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
internalSocket := config.Config.GitalyInternalSocketPath()
@@ -224,7 +224,7 @@ func TestSuccessfulGitHooksForUserCreateBranchRequest(t *testing.T) {
}
func testSuccessfulGitHooksForUserCreateBranchRequest(t *testing.T, ctx context.Context) {
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
serverSocketPath, stop := runOperationServiceServer(t)
@@ -268,7 +268,7 @@ func TestSuccessfulCreateBranchRequestWithStartPointRefPrefix(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -341,7 +341,7 @@ func TestFailedUserCreateBranchDueToHooks(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
serverSocketPath, stop := runOperationServiceServer(t)
@@ -380,7 +380,7 @@ func TestFailedUserCreateBranchRequest(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -444,7 +444,7 @@ func TestSuccessfulUserDeleteBranchRequest(t *testing.T) {
}
func testSuccessfulUserDeleteBranchRequest(t *testing.T, ctx context.Context) {
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
serverSocketPath, stop := runOperationServiceServer(t)
@@ -500,7 +500,7 @@ func testSuccessfulUserDeleteBranchRequest(t *testing.T, ctx context.Context) {
}
func TestSuccessfulGitHooksForUserDeleteBranchRequest(t *testing.T) {
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
serverSocketPath, stop := runOperationServiceServer(t)
@@ -537,7 +537,7 @@ func TestSuccessfulGitHooksForUserDeleteBranchRequest(t *testing.T) {
}
func TestUserDeleteBranch_transaction(t *testing.T) {
- repo, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repo, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
// This creates a new branch "delete-me" which exists both in the packed-refs file and as a
@@ -610,7 +610,7 @@ func TestFailedUserDeleteBranchDueToValidation(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -662,7 +662,7 @@ func TestUserDeleteBranchFailedDueToRefsHeadsPrefix(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
serverSocketPath, stop := runOperationServiceServer(t)
@@ -716,7 +716,7 @@ func TestFailedUserDeleteBranchDueToHooks(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
serverSocketPath, stop := runOperationServiceServer(t)
@@ -761,7 +761,7 @@ func TestBranchHookOutput(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
diff --git a/internal/gitaly/service/operations/cherry_pick_test.go b/internal/gitaly/service/operations/cherry_pick_test.go
index a55b784c4..9e4b5536d 100644
--- a/internal/gitaly/service/operations/cherry_pick_test.go
+++ b/internal/gitaly/service/operations/cherry_pick_test.go
@@ -29,7 +29,7 @@ func testServerUserCherryPickSuccessful(t *testing.T, ctxOuter context.Context)
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -42,7 +42,7 @@ func testServerUserCherryPickSuccessful(t *testing.T, ctxOuter context.Context)
cherryPickedCommit, err := repo.ReadCommit(ctxOuter, "8a0f2ee90d940bfb0ba1e14e8214b0649056e4ab")
require.NoError(t, err)
- testRepoCopy, testRepoCopyPath, cleanup := testhelper.NewTestRepo(t) // read-only repo
+ testRepoCopy, testRepoCopyPath, cleanup := gittest.CloneRepo(t) // read-only repo
defer cleanup()
testhelper.MustRunCommand(t, nil, "git", "-C", testRepoCopyPath, "branch", destinationBranch, "master")
@@ -200,7 +200,7 @@ func testServerUserCherryPickSuccessfulGitHooks(t *testing.T, ctxOuter context.C
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -249,7 +249,7 @@ func testServerUserCherryPickStableID(t *testing.T, ctx context.Context) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -315,7 +315,7 @@ func testServerUserCherryPickFailedValidations(t *testing.T, ctxOuter context.Co
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, _, cleanup := testhelper.NewTestRepo(t)
+ repoProto, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -397,7 +397,7 @@ func testServerUserCherryPickFailedWithPreReceiveError(t *testing.T, ctxOuter co
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -443,7 +443,7 @@ func testServerUserCherryPickFailedWithCreateTreeError(t *testing.T, ctxOuter co
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -482,7 +482,7 @@ func testServerUserCherryPickFailedWithCommitError(t *testing.T, ctxOuter contex
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -522,7 +522,7 @@ func testServerUserCherryPickFailedWithConflict(t *testing.T, ctxOuter context.C
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -561,7 +561,7 @@ func testServerUserCherryPickSuccessfulWithGivenCommits(t *testing.T, ctxOuter c
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
diff --git a/internal/gitaly/service/operations/commit_files_test.go b/internal/gitaly/service/operations/commit_files_test.go
index 04de73ee8..7a01e70c6 100644
--- a/internal/gitaly/service/operations/commit_files_test.go
+++ b/internal/gitaly/service/operations/commit_files_test.go
@@ -70,7 +70,7 @@ func testUserCommitFiles(t *testing.T, ctx context.Context) {
targetRelativePath, err := filepath.Rel(testhelper.GitlabTestStoragePath(), filepath.Join(storageRoot, "target-repository"))
require.NoError(t, err)
- startRepo, _, cleanStartRepo := testhelper.InitBareRepo(t)
+ startRepo, _, cleanStartRepo := gittest.InitBareRepo(t)
defer cleanStartRepo()
repoPath := filepath.Join(testhelper.GitlabTestStoragePath(), targetRelativePath)
@@ -922,7 +922,7 @@ func testUserCommitFiles(t *testing.T, ctx context.Context) {
for i, step := range tc.steps {
headerRequest := headerRequest(
- testhelper.CreateRepo(t, storageRoot, targetRelativePath),
+ gittest.InitRepoDir(t, storageRoot, targetRelativePath),
testhelper.TestUser,
branch,
[]byte("commit message"),
@@ -977,7 +977,7 @@ func testUserCommitFilesStableCommitID(t *testing.T, ctx context.Context) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.InitBareRepo(t)
+ repoProto, repoPath, cleanup := gittest.InitBareRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -1035,7 +1035,7 @@ func TestSuccessfulUserCommitFilesRequest(t *testing.T) {
}
func testSuccessfulUserCommitFilesRequest(t *testing.T, ctx context.Context) {
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
serverSocketPath, stop := runOperationServiceServer(t)
@@ -1044,7 +1044,7 @@ func testSuccessfulUserCommitFilesRequest(t *testing.T, ctx context.Context) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- newRepo, newRepoPath, newRepoCleanupFn := testhelper.InitBareRepo(t)
+ newRepo, newRepoPath, newRepoCleanupFn := gittest.InitBareRepo(t)
defer newRepoCleanupFn()
filePath := "héllo/wörld"
@@ -1165,7 +1165,7 @@ func testSuccessfulUserCommitFilesRequestMove(t *testing.T, ctx context.Context)
{content: "foo", infer: true},
} {
t.Run(strconv.Itoa(i), func(t *testing.T) {
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
origFileContent := testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "show", branchName+":"+previousFilePath)
@@ -1211,7 +1211,7 @@ func testSuccessfulUserCommitFilesRequestForceCommit(t *testing.T, ctx context.C
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -1263,7 +1263,7 @@ func testSuccessfulUserCommitFilesRequestStartSha(t *testing.T, ctx context.Cont
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, _, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -1316,11 +1316,11 @@ func testSuccessfulUserCommitFilesRemoteRepositoryRequest(setHeader func(header
gitCmdFactory := git.NewExecCommandFactory(config.Config)
- repoProto, _, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(gitCmdFactory, repoProto, config.Config)
- newRepoProto, _, newRepoCleanupFn := testhelper.InitBareRepo(t)
+ newRepoProto, _, newRepoCleanupFn := gittest.InitBareRepo(t)
defer newRepoCleanupFn()
newRepo := localrepo.New(gitCmdFactory, newRepoProto, config.Config)
@@ -1368,7 +1368,7 @@ func testSuccessfulUserCommitFilesRequestWithSpecialCharactersInSignature(t *tes
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, _, cleanupFn := testhelper.InitBareRepo(t)
+ repoProto, _, cleanupFn := gittest.InitBareRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -1425,7 +1425,7 @@ func testFailedUserCommitFilesRequestDueToHooks(t *testing.T, ctx context.Contex
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
branchName := "feature"
@@ -1466,7 +1466,7 @@ func testFailedUserCommitFilesRequestDueToIndexError(t *testing.T, ctx context.C
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -1537,7 +1537,7 @@ func testFailedUserCommitFilesRequest(t *testing.T, ctx context.Context) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
branchName := "feature"
diff --git a/internal/gitaly/service/operations/merge_test.go b/internal/gitaly/service/operations/merge_test.go
index fbf10067a..74df8510e 100644
--- a/internal/gitaly/service/operations/merge_test.go
+++ b/internal/gitaly/service/operations/merge_test.go
@@ -40,7 +40,7 @@ func testWithFeature(t *testing.T, feature featureflag.FeatureFlag, testcase fun
}
func TestSuccessfulMerge(t *testing.T) {
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -129,7 +129,7 @@ func TestSuccessfulMerge(t *testing.T) {
}
func TestSuccessfulMerge_stableMergeIDs(t *testing.T) {
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -210,7 +210,7 @@ func TestAbortedMerge(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -273,7 +273,7 @@ func TestAbortedMerge(t *testing.T) {
}
func TestFailedMergeConcurrentUpdate(t *testing.T) {
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -321,7 +321,7 @@ func TestFailedMergeConcurrentUpdate(t *testing.T) {
}
func TestUserMergeBranch_ambiguousReference(t *testing.T) {
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -390,7 +390,7 @@ func TestUserMergeBranch_ambiguousReference(t *testing.T) {
}
func TestFailedMergeDueToHooks(t *testing.T) {
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
serverSocketPath, stop := runOperationServiceServer(t)
@@ -453,7 +453,7 @@ func TestSuccessfulUserFFBranchRequest(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -491,7 +491,7 @@ func TestFailedUserFFBranchRequest(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
commitID := "cfe32cf61b73a0d5e9f13e774abde7ff789b1660"
@@ -585,7 +585,7 @@ func TestFailedUserFFBranchDueToHooks(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
commitID := "cfe32cf61b73a0d5e9f13e774abde7ff789b1660"
@@ -623,7 +623,7 @@ func TestUserFFBranch_ambiguousReference(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer func() { require.NoError(t, conn.Close()) }()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -677,7 +677,7 @@ func TestSuccessfulUserMergeToRefRequest(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -787,7 +787,7 @@ func TestConflictsOnUserMergeToRefRequest(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "branch", mergeBranchName, "824be604a34828eb682305f0d963056cfac87b2d")
@@ -837,7 +837,7 @@ func TestUserMergeToRef_stableMergeID(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -894,7 +894,7 @@ func TestFailedUserMergeToRefRequest(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "branch", mergeBranchName, mergeBranchHeadBefore)
@@ -996,7 +996,7 @@ func TestUserMergeToRefIgnoreHooksRequest(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "branch", mergeBranchName, mergeBranchHeadBefore)
diff --git a/internal/gitaly/service/operations/rebase_test.go b/internal/gitaly/service/operations/rebase_test.go
index b61ab66a7..954122f3c 100644
--- a/internal/gitaly/service/operations/rebase_test.go
+++ b/internal/gitaly/service/operations/rebase_test.go
@@ -38,11 +38,11 @@ func TestSuccessfulUserRebaseConfirmableRequest(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
- repoCopyProto, _, cleanup := testhelper.NewTestRepo(t)
+ repoCopyProto, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
branchSha := getBranchSha(t, repoPath, rebaseBranchName)
@@ -110,7 +110,7 @@ func TestUserRebaseConfirmable_stableCommitIDs(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -193,10 +193,10 @@ func TestFailedRebaseUserRebaseConfirmableRequestDueToInvalidHeader(t *testing.T
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
- testRepoCopy, _, cleanup := testhelper.NewTestRepo(t)
+ testRepoCopy, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
branchSha := getBranchSha(t, testRepoPath, rebaseBranchName)
@@ -279,10 +279,10 @@ func TestAbortedUserRebaseConfirmable(t *testing.T) {
for i, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
- testRepoCopy, _, cleanup := testhelper.NewTestRepo(t)
+ testRepoCopy, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
branchSha := getBranchSha(t, testRepoPath, rebaseBranchName)
@@ -331,11 +331,11 @@ func TestFailedUserRebaseConfirmableDueToApplyBeingFalse(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
- testRepoCopy, _, cleanup := testhelper.NewTestRepo(t)
+ testRepoCopy, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
branchSha := getBranchSha(t, repoPath, rebaseBranchName)
@@ -378,11 +378,11 @@ func TestFailedUserRebaseConfirmableRequestDueToPreReceiveError(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
- repoCopyProto, _, cleanup := testhelper.NewTestRepo(t)
+ repoCopyProto, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
branchSha := getBranchSha(t, repoPath, rebaseBranchName)
@@ -439,10 +439,10 @@ func TestFailedUserRebaseConfirmableDueToGitError(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
- testRepoCopy, _, cleanup := testhelper.NewTestRepo(t)
+ testRepoCopy, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
failedBranchName := "rebase-encoding-failure-trigger"
@@ -485,11 +485,11 @@ func TestRebaseRequestWithDeletedFile(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoProtoPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ repoProto, repoProtoPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
- repoCopyProto, _, cleanup := testhelper.NewTestRepo(t)
+ repoCopyProto, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
md := testhelper.GitalyServersMetadata(t, serverSocketPath)
@@ -543,11 +543,11 @@ func TestRebaseOntoRemoteBranch(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- localRepoProto, localRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ localRepoProto, localRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
localRepo := localrepo.New(git.NewExecCommandFactory(config.Config), localRepoProto, config.Config)
- remoteRepo, remoteRepoPath, cleanup := testhelper.NewTestRepoWithWorktree(t)
+ remoteRepo, remoteRepoPath, cleanup := gittest.CloneRepoWithWorktree(t)
defer cleanup()
ctx, cancel := testhelper.Context()
diff --git a/internal/gitaly/service/operations/revert_test.go b/internal/gitaly/service/operations/revert_test.go
index c4c9c89a6..9fb70139c 100644
--- a/internal/gitaly/service/operations/revert_test.go
+++ b/internal/gitaly/service/operations/revert_test.go
@@ -27,7 +27,7 @@ func testServerUserRevertSuccessful(t *testing.T, ctxOuter context.Context) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -40,7 +40,7 @@ func testServerUserRevertSuccessful(t *testing.T, ctxOuter context.Context) {
revertedCommit, err := repo.ReadCommit(ctxOuter, "d59c60028b053793cecfb4022de34602e1a9218e")
require.NoError(t, err)
- testRepoCopy, testRepoCopyPath, cleanup := testhelper.NewTestRepo(t) // read-only repo
+ testRepoCopy, testRepoCopyPath, cleanup := gittest.CloneRepo(t) // read-only repo
defer cleanup()
testhelper.MustRunCommand(t, nil, "git", "-C", testRepoCopyPath, "branch", destinationBranch, "master")
@@ -193,7 +193,7 @@ func testServerUserRevertStableID(t *testing.T, ctxOuter context.Context) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, _, cleanup := testhelper.NewTestRepo(t)
+ repoProto, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -259,7 +259,7 @@ func testServerUserRevertSuccessfulIntoNewRepo(t *testing.T, ctxOuter context.Co
gitCmdFactory := git.NewExecCommandFactory(config.Config)
- startRepoProto, _, cleanup := testhelper.NewTestRepo(t)
+ startRepoProto, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
startRepo := localrepo.New(gitCmdFactory, startRepoProto, config.Config)
@@ -269,7 +269,7 @@ func testServerUserRevertSuccessfulIntoNewRepo(t *testing.T, ctxOuter context.Co
masterHeadCommit, err := startRepo.ReadCommit(ctxOuter, "master")
require.NoError(t, err)
- repoProto, _, cleanup := testhelper.InitBareRepo(t)
+ repoProto, _, cleanup := gittest.InitBareRepo(t)
defer cleanup()
repo := localrepo.New(gitCmdFactory, repoProto, config.Config)
@@ -316,7 +316,7 @@ func testServerUserRevertSuccessfulGitHooks(t *testing.T, ctxOuter context.Conte
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -365,7 +365,7 @@ func testServerUserRevertFailuedDueToValidations(t *testing.T, ctxOuter context.
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, _, cleanup := testhelper.NewTestRepo(t)
+ repoProto, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -447,7 +447,7 @@ func testServerUserRevertFailedDueToPreReceiveError(t *testing.T, ctxOuter conte
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -493,7 +493,7 @@ func testServerUserRevertFailedDueToCreateTreeError(t *testing.T, ctxOuter conte
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -532,7 +532,7 @@ func testServerUserRevertFailedDueToCommitError(t *testing.T, ctxOuter context.C
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
diff --git a/internal/gitaly/service/operations/squash_test.go b/internal/gitaly/service/operations/squash_test.go
index 75ef95981..b208abd08 100644
--- a/internal/gitaly/service/operations/squash_test.go
+++ b/internal/gitaly/service/operations/squash_test.go
@@ -12,6 +12,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/helper/text"
@@ -53,7 +54,7 @@ func testSuccessfulUserSquashRequest(t *testing.T, ctx context.Context, start, e
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -92,7 +93,7 @@ func TestUserSquash_stableID(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, _, cleanup := testhelper.NewTestRepo(t)
+ repoProto, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -161,7 +162,7 @@ func TestSuccessfulUserSquashRequestWith3wayMerge(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -214,7 +215,7 @@ func TestSplitIndex(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
require.False(t, ensureSplitIndexExists(t, testRepoPath))
@@ -245,7 +246,7 @@ func TestSquashRequestWithRenamedFiles(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -308,7 +309,7 @@ func TestSuccessfulUserSquashRequestWithMissingFileOnTargetBranch(t *testing.T)
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
conflictingStartSha := "bbd36ad238d14e1c03ece0f3358f545092dc9ca3"
@@ -335,7 +336,7 @@ func TestFailedUserSquashRequestDueToValidations(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
testCases := []struct {
@@ -468,7 +469,7 @@ func TestUserSquashWithGitError(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
testCases := []struct {
diff --git a/internal/gitaly/service/operations/submodules_test.go b/internal/gitaly/service/operations/submodules_test.go
index c90bf0f8b..e7c416ef7 100644
--- a/internal/gitaly/service/operations/submodules_test.go
+++ b/internal/gitaly/service/operations/submodules_test.go
@@ -9,6 +9,7 @@ import (
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/internal/git/lstree"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
@@ -31,7 +32,7 @@ func testSuccessfulUserUpdateSubmoduleRequest(t *testing.T, ctx context.Context)
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepoProto, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepoProto, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
testRepo := localrepo.New(git.NewExecCommandFactory(config.Config), testRepoProto, config.Config)
@@ -122,7 +123,7 @@ func testUserUpdateSubmoduleStableID(t *testing.T, ctx context.Context) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, _, cleanup := testhelper.NewTestRepo(t)
+ repoProto, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -178,7 +179,7 @@ func testFailedUserUpdateSubmoduleRequestDueToValidations(t *testing.T, ctx cont
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
testCases := []struct {
@@ -309,7 +310,7 @@ func testFailedUserUpdateSubmoduleRequestDueToInvalidBranch(t *testing.T, ctx co
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
request := &gitalypb.UserUpdateSubmoduleRequest{
@@ -339,7 +340,7 @@ func testFailedUserUpdateSubmoduleRequestDueToInvalidSubmodule(t *testing.T, ctx
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
request := &gitalypb.UserUpdateSubmoduleRequest{
@@ -369,7 +370,7 @@ func testFailedUserUpdateSubmoduleRequestDueToSameReference(t *testing.T, ctx co
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
request := &gitalypb.UserUpdateSubmoduleRequest{
@@ -402,7 +403,7 @@ func testFailedUserUpdateSubmoduleRequestDueToRepositoryEmpty(t *testing.T, ctx
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanup := testhelper.InitRepoWithWorktree(t)
+ testRepo, _, cleanup := gittest.InitRepoWithWorktree(t)
defer cleanup()
request := &gitalypb.UserUpdateSubmoduleRequest{
diff --git a/internal/gitaly/service/operations/tags_test.go b/internal/gitaly/service/operations/tags_test.go
index cd4a5273d..50ee82327 100644
--- a/internal/gitaly/service/operations/tags_test.go
+++ b/internal/gitaly/service/operations/tags_test.go
@@ -41,7 +41,7 @@ func testSuccessfulUserDeleteTagRequest(t *testing.T, ctx context.Context) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
tagNameInput := "to-be-deleted-soon-tag"
@@ -74,7 +74,7 @@ func testSuccessfulGitHooksForUserDeleteTagRequest(t *testing.T, ctx context.Con
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
tagNameInput := "to-be-déleted-soon-tag"
@@ -184,7 +184,7 @@ func testSuccessfulUserCreateTagRequest(t *testing.T, ctx context.Context) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -280,7 +280,7 @@ func TestUserCreateTagWithTransaction(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -441,7 +441,7 @@ func testSuccessfulUserCreateTagRequestAnnotatedLightweightDisambiguation(t *tes
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
preReceiveHook, cleanup := writeAssertObjectTypePreReceiveHook(t)
@@ -543,7 +543,7 @@ func testSuccessfulUserCreateTagRequestWithParsedTargetRevision(t *testing.T, ct
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "branch", "heads/master", "master~1")
@@ -629,7 +629,7 @@ func TestSuccessfulUserCreateTagRequestToNonCommit(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
inputTagName := "to-be-créated-soon"
@@ -750,7 +750,7 @@ func TestSuccessfulUserCreateTagNestedTags(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -885,7 +885,7 @@ func TestUserCreateTagStableTagIDs(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
response, err := client.UserCreateTag(ctx, &gitalypb.UserCreateTagRequest{
@@ -916,7 +916,7 @@ func TestUserDeleteTagsuccessfulDeletionOfPrefixedTag(t *testing.T) {
}
func testUserDeleteTagsuccessfulDeletionOfPrefixedTag(t *testing.T, ctx context.Context) {
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
serverSocketPath, stop := runOperationServiceServer(t)
@@ -967,7 +967,7 @@ func TestUserCreateTagsuccessfulCreationOfPrefixedTag(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -1035,7 +1035,7 @@ func TestSuccessfulGitHooksForUserCreateTagRequest(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
projectPath := "project/path"
@@ -1078,7 +1078,7 @@ func TestFailedUserDeleteTagRequestDueToValidation(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -1159,7 +1159,7 @@ func testFailedUserDeleteTagDueToHooks(t *testing.T, ctx context.Context) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
tagNameInput := "to-be-deleted-soon-tag"
@@ -1199,7 +1199,7 @@ func TestFailedUserCreateTagDueToHooks(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
request := &gitalypb.UserCreateTagRequest{
@@ -1231,7 +1231,7 @@ func TestFailedUserCreateTagRequestDueToTagExistence(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -1289,7 +1289,7 @@ func TestFailedUserCreateTagRequestDueToValidation(t *testing.T) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
injectedTag := "inject-tag\ntagger . <> 0 +0000\n\nInjected subject\n\n"
@@ -1417,7 +1417,7 @@ func testTagHookOutput(t *testing.T, ctx context.Context) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
diff --git a/internal/gitaly/service/operations/update_branches_test.go b/internal/gitaly/service/operations/update_branches_test.go
index 2344738d9..0ebf90651 100644
--- a/internal/gitaly/service/operations/update_branches_test.go
+++ b/internal/gitaly/service/operations/update_branches_test.go
@@ -32,7 +32,7 @@ func TestSuccessfulUserUpdateBranchRequest(t *testing.T) {
}
func testSuccessfulUserUpdateBranchRequest(t *testing.T, ctx context.Context) {
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -120,7 +120,7 @@ func testSuccessfulUserUpdateBranchRequestToDelete(t *testing.T, ctx context.Con
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -198,7 +198,7 @@ func testSuccessfulGitHooksForUserUpdateBranchRequest(t *testing.T, ctx context.
for _, hookName := range GitlabHooks {
t.Run(hookName, func(t *testing.T) {
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
hookOutputTempPath, cleanup := gittest.WriteEnvToCustomHook(t, testRepoPath, hookName)
@@ -229,7 +229,7 @@ func TestFailedUserUpdateBranchDueToHooks(t *testing.T) {
}
func testFailedUserUpdateBranchDueToHooks(t *testing.T, ctx context.Context) {
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
serverSocketPath, stop := runOperationServiceServer(t)
@@ -276,7 +276,7 @@ func testFailedUserUpdateBranchRequest(t *testing.T, ctx context.Context) {
client, conn := newOperationClient(t, serverSocketPath)
defer conn.Close()
- repoProto, _, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
diff --git a/internal/gitaly/service/operations/update_with_hooks_test.go b/internal/gitaly/service/operations/update_with_hooks_test.go
index 18c10a9e2..5f79dd64a 100644
--- a/internal/gitaly/service/operations/update_with_hooks_test.go
+++ b/internal/gitaly/service/operations/update_with_hooks_test.go
@@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/hook"
@@ -45,7 +46,7 @@ func (m *mockHookManager) ReferenceTransactionHook(ctx context.Context, state ho
}
func TestUpdateReferenceWithHooks_invalidParameters(t *testing.T) {
- repo, _, cleanup := testhelper.NewTestRepo(t)
+ repo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
user := &gitalypb.User{
@@ -133,7 +134,7 @@ func TestUpdateReferenceWithHooks(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- repo, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repo, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
payload, err := git.NewHooksPayload(config.Config, repo, nil, nil, &git.ReceiveHooksPayload{
diff --git a/internal/gitaly/service/ref/branches_test.go b/internal/gitaly/service/ref/branches_test.go
index f70d22e54..1e402d96b 100644
--- a/internal/gitaly/service/ref/branches_test.go
+++ b/internal/gitaly/service/ref/branches_test.go
@@ -5,6 +5,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -22,7 +23,7 @@ func TestSuccessfulFindBranchRequest(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepoProto, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepoProto, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), testRepoProto, config.Config)
@@ -99,7 +100,7 @@ func TestFailedFindBranchRequest(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
diff --git a/internal/gitaly/service/ref/delete_refs_test.go b/internal/gitaly/service/ref/delete_refs_test.go
index 33bbc87d7..f3af00345 100644
--- a/internal/gitaly/service/ref/delete_refs_test.go
+++ b/internal/gitaly/service/ref/delete_refs_test.go
@@ -6,6 +6,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -40,7 +41,7 @@ func TestSuccessfulDeleteRefs(t *testing.T) {
for _, testCase := range testCases {
t.Run(testCase.desc, func(t *testing.T) {
- repo, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repo, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testhelper.MustRunCommand(t, nil, "git", "-C", repoPath, "update-ref", "refs/delete/a", "b83d6e391c22777fca1ed3012fce84f633d7fed0")
@@ -83,7 +84,7 @@ func TestFailedDeleteRefsRequestDueToGitError(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- repo, _, cleanupFn := testhelper.NewTestRepo(t)
+ repo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
request := &gitalypb.DeleteRefsRequest{
@@ -104,7 +105,7 @@ func TestFailedDeleteRefsDueToValidation(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
diff --git a/internal/gitaly/service/ref/list_new_blobs_test.go b/internal/gitaly/service/ref/list_new_blobs_test.go
index 6e16e8c5d..9eee39248 100644
--- a/internal/gitaly/service/ref/list_new_blobs_test.go
+++ b/internal/gitaly/service/ref/list_new_blobs_test.go
@@ -5,6 +5,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -21,7 +22,7 @@ func TestListNewBlobs(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
oid := "ab2c9622c02288a2bbaaf35d96088cfdff31d9d9"
diff --git a/internal/gitaly/service/ref/list_new_commits_test.go b/internal/gitaly/service/ref/list_new_commits_test.go
index a75ed8c68..fdc0cd6b6 100644
--- a/internal/gitaly/service/ref/list_new_commits_test.go
+++ b/internal/gitaly/service/ref/list_new_commits_test.go
@@ -5,6 +5,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -21,7 +22,7 @@ func TestListNewCommits(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
oid := "0031876facac3f2b2702a0e53a26e89939a42209"
diff --git a/internal/gitaly/service/ref/pack_refs_test.go b/internal/gitaly/service/ref/pack_refs_test.go
index 3aea0659b..ef7c58c99 100644
--- a/internal/gitaly/service/ref/pack_refs_test.go
+++ b/internal/gitaly/service/ref/pack_refs_test.go
@@ -12,6 +12,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -28,7 +29,7 @@ func TestPackRefsSuccessfulRequest(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
packedRefs := linesInPackfile(t, testRepoPath)
diff --git a/internal/gitaly/service/ref/refexists_test.go b/internal/gitaly/service/ref/refexists_test.go
index 557699fda..202acb359 100644
--- a/internal/gitaly/service/ref/refexists_test.go
+++ b/internal/gitaly/service/ref/refexists_test.go
@@ -3,6 +3,7 @@ package ref
import (
"testing"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/helper"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -10,7 +11,7 @@ import (
)
func TestRefExists(t *testing.T) {
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
badRepo := &gitalypb.Repository{StorageName: "invalid", RelativePath: "/etc/"}
diff --git a/internal/gitaly/service/ref/refname_test.go b/internal/gitaly/service/ref/refname_test.go
index c078e92a7..b73bb857a 100644
--- a/internal/gitaly/service/ref/refname_test.go
+++ b/internal/gitaly/service/ref/refname_test.go
@@ -5,6 +5,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/helper"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -18,7 +19,7 @@ func TestFindRefNameSuccess(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rpcRequest := &gitalypb.FindRefNameRequest{
@@ -48,7 +49,7 @@ func TestFindRefNameEmptyCommit(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rpcRequest := &gitalypb.FindRefNameRequest{
@@ -109,7 +110,7 @@ func TestFindRefNameInvalidPrefix(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rpcRequest := &gitalypb.FindRefNameRequest{
@@ -136,7 +137,7 @@ func TestFindRefNameInvalidObject(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rpcRequest := &gitalypb.FindRefNameRequest{
diff --git a/internal/gitaly/service/ref/refs_test.go b/internal/gitaly/service/ref/refs_test.go
index aaab83716..1bde2e1da 100644
--- a/internal/gitaly/service/ref/refs_test.go
+++ b/internal/gitaly/service/ref/refs_test.go
@@ -42,7 +42,7 @@ func TestSuccessfulFindAllBranchNames(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rpcRequest := &gitalypb.FindAllBranchNamesRequest{Repository: testRepo}
@@ -78,7 +78,7 @@ func TestFindAllBranchNamesVeryLargeResponse(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -185,7 +185,7 @@ func TestSuccessfulFindAllTagNames(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rpcRequest := &gitalypb.FindAllTagNamesRequest{Repository: testRepo}
@@ -271,7 +271,7 @@ func TestHeadReference(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
headRef, err := headReference(ctx, git.NewExecCommandFactory(config.Config), testRepo)
@@ -284,7 +284,7 @@ func TestHeadReference(t *testing.T) {
}
func TestHeadReferenceWithNonExistingHead(t *testing.T) {
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
// Write bad HEAD
@@ -328,7 +328,7 @@ func TestSetDefaultBranchRef(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
gitCmdFactory := git.NewExecCommandFactory(config.Config)
@@ -350,7 +350,7 @@ func TestDefaultBranchName(t *testing.T) {
headReference = _headReference
}()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -426,7 +426,7 @@ func TestSuccessfulFindDefaultBranchName(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rpcRequest := &gitalypb.FindDefaultBranchNameRequest{Repository: testRepo}
@@ -482,7 +482,7 @@ func TestSuccessfulFindAllTagsRequest(t *testing.T) {
stop, serverSocketPath := runRefServiceServer(t)
defer stop()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -684,7 +684,7 @@ func TestFindAllTagNestedTags(t *testing.T) {
stop, serverSocketPath := runRefServiceServer(t)
defer stop()
- testRepoCopy, testRepoCopyPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ testRepoCopy, testRepoCopyPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
blobID := "faaf198af3a36dbf41961466703cc1d47c61d051"
@@ -839,7 +839,7 @@ func TestSuccessfulFindLocalBranches(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rpcRequest := &gitalypb.FindLocalBranchesRequest{Repository: testRepo}
@@ -893,7 +893,7 @@ func TestFindLocalBranchesPagination(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -996,7 +996,7 @@ func TestFindLocalBranchesSort(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
for _, testCase := range testCases {
@@ -1085,7 +1085,7 @@ func TestSuccessfulFindAllBranchesRequest(t *testing.T) {
},
}
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
gittest.CreateRemoteBranch(t, config.Config.Git.BinPath, testRepoPath, "origin",
@@ -1120,7 +1120,7 @@ func TestSuccessfulFindAllBranchesRequestWithMergedBranches(t *testing.T) {
stop, serverSocketPath := runRefServiceServer(t)
defer stop()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -1275,7 +1275,7 @@ func TestListTagNamesContainingCommit(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -1352,7 +1352,7 @@ func TestListBranchNamesContainingCommit(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -1443,7 +1443,7 @@ func TestSuccessfulFindTagRequest(t *testing.T) {
stop, serverSocketPath := runRefServiceServer(t)
defer stop()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -1614,7 +1614,7 @@ func TestFindTagNestedTag(t *testing.T) {
stop, serverSocketPath := runRefServiceServer(t)
defer stop()
- testRepoCopy, testRepoCopyPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ testRepoCopy, testRepoCopyPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
blobID := "faaf198af3a36dbf41961466703cc1d47c61d051"
@@ -1706,7 +1706,7 @@ func TestInvalidFindTagRequest(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
diff --git a/internal/gitaly/service/ref/remote_branches_test.go b/internal/gitaly/service/ref/remote_branches_test.go
index 882c04b50..7c9a5cdc4 100644
--- a/internal/gitaly/service/ref/remote_branches_test.go
+++ b/internal/gitaly/service/ref/remote_branches_test.go
@@ -24,7 +24,7 @@ func TestSuccessfulFindAllRemoteBranchesRequest(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- repoProto, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ repoProto, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
@@ -88,7 +88,7 @@ func TestInvalidFindAllRemoteBranchesRequest(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
diff --git a/internal/gitaly/service/ref/tag_messages_test.go b/internal/gitaly/service/ref/tag_messages_test.go
index 16dac869b..513acc6e7 100644
--- a/internal/gitaly/service/ref/tag_messages_test.go
+++ b/internal/gitaly/service/ref/tag_messages_test.go
@@ -6,6 +6,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/helper"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -19,7 +20,7 @@ func TestSuccessfulGetTagMessagesRequest(t *testing.T) {
client, conn := newRefServiceClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
diff --git a/internal/gitaly/service/remote/fetch_internal_remote_test.go b/internal/gitaly/service/remote/fetch_internal_remote_test.go
index 95d095e3c..a43d58d0a 100644
--- a/internal/gitaly/service/remote/fetch_internal_remote_test.go
+++ b/internal/gitaly/service/remote/fetch_internal_remote_test.go
@@ -69,7 +69,7 @@ func TestSuccessfulFetchInternalRemote(t *testing.T) {
gitaly1Socket, cleanup := remote.RunRemoteServiceServer(t, testhelper.WithStorages([]string{"gitaly-1"}))
defer cleanup()
- repo, _, cleanup := testhelper.NewTestRepo(t)
+ repo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
gitaly0Repo, gitaly0RepoPath, cleanup := cloneRepoAtStorage(t, locator, repo, "gitaly-0")
@@ -124,7 +124,7 @@ func TestFailedFetchInternalRemote(t *testing.T) {
client, conn := remote.NewRemoteClient(t, serverSocketPath)
defer conn.Close()
- repo, _, cleanupFn := testhelper.InitBareRepo(t)
+ repo, _, cleanupFn := gittest.InitBareRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
diff --git a/internal/gitaly/service/remote/find_remote_root_ref_test.go b/internal/gitaly/service/remote/find_remote_root_ref_test.go
index 2fc2351a6..fb4a50ccd 100644
--- a/internal/gitaly/service/remote/find_remote_root_ref_test.go
+++ b/internal/gitaly/service/remote/find_remote_root_ref_test.go
@@ -4,6 +4,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -16,7 +17,7 @@ func TestFindRemoteRootRefSuccess(t *testing.T) {
client, conn := NewRemoteClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
request := &gitalypb.FindRemoteRootRefRequest{Repository: testRepo, Remote: "origin"}
@@ -37,7 +38,7 @@ func TestFindRemoteRootRefFailedDueToValidation(t *testing.T) {
invalidRepo := &gitalypb.Repository{StorageName: "fake", RelativePath: "path"}
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -83,7 +84,7 @@ func TestFindRemoteRootRefFailedDueToInvalidRemote(t *testing.T) {
client, conn := NewRemoteClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
request := &gitalypb.FindRemoteRootRefRequest{Repository: testRepo, Remote: "invalid"}
diff --git a/internal/gitaly/service/remote/remotes_test.go b/internal/gitaly/service/remote/remotes_test.go
index 350b890cb..bb55c0135 100644
--- a/internal/gitaly/service/remote/remotes_test.go
+++ b/internal/gitaly/service/remote/remotes_test.go
@@ -9,6 +9,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -21,7 +22,7 @@ func TestSuccessfulAddRemote(t *testing.T) {
client, conn := NewRemoteClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -105,7 +106,7 @@ func TestFailedAddRemoteDueToValidation(t *testing.T) {
client, conn := NewRemoteClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -152,7 +153,7 @@ func TestSuccessfulRemoveRemote(t *testing.T) {
client, conn := NewRemoteClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -202,7 +203,7 @@ func TestFailedRemoveRemoteDueToValidation(t *testing.T) {
client, conn := NewRemoteClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -280,7 +281,7 @@ func TestListDifferentPushUrlRemote(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
client.RemoveRemote(ctx, &gitalypb.RemoveRemoteRequest{
@@ -327,13 +328,13 @@ func TestListRemotes(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- repoWithSingleRemote, _, cleanupFn := testhelper.NewTestRepo(t)
+ repoWithSingleRemote, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- repoWithMultipleRemotes, _, cleanupFn := testhelper.NewTestRepo(t)
+ repoWithMultipleRemotes, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- repoWithEmptyRemote, _, cleanupFn := testhelper.NewTestRepo(t)
+ repoWithEmptyRemote, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
singleRemote := []*gitalypb.ListRemotesResponse_Remote{
diff --git a/internal/gitaly/service/remote/update_remote_mirror_test.go b/internal/gitaly/service/remote/update_remote_mirror_test.go
index d4c075d34..0f210db04 100644
--- a/internal/gitaly/service/remote/update_remote_mirror_test.go
+++ b/internal/gitaly/service/remote/update_remote_mirror_test.go
@@ -21,10 +21,10 @@ func TestSuccessfulUpdateRemoteMirrorRequest(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- _, mirrorPath, mirrorCleanupFn := testhelper.NewTestRepo(t)
+ _, mirrorPath, mirrorCleanupFn := gittest.CloneRepo(t)
defer mirrorCleanupFn()
remoteName := "remote_mirror_1"
@@ -115,10 +115,10 @@ func TestSuccessfulUpdateRemoteMirrorRequestWithWildcards(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- _, mirrorPath, mirrorCleanupFn := testhelper.NewTestRepo(t)
+ _, mirrorPath, mirrorCleanupFn := gittest.CloneRepo(t)
defer mirrorCleanupFn()
remoteName := "remote_mirror_2"
@@ -193,10 +193,10 @@ func TestSuccessfulUpdateRemoteMirrorRequestWithKeepDivergentRefs(t *testing.T)
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- _, mirrorPath, mirrorCleanupFn := testhelper.NewTestRepo(t)
+ _, mirrorPath, mirrorCleanupFn := gittest.CloneRepo(t)
defer mirrorCleanupFn()
remoteName := "remote_mirror_1"
@@ -270,7 +270,7 @@ func TestFailedUpdateRemoteMirrorRequestDueToValidation(t *testing.T) {
client, conn := NewRemoteClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
diff --git a/internal/gitaly/service/repository/apply_gitattributes_test.go b/internal/gitaly/service/repository/apply_gitattributes_test.go
index ebb9af90b..459a926c8 100644
--- a/internal/gitaly/service/repository/apply_gitattributes_test.go
+++ b/internal/gitaly/service/repository/apply_gitattributes_test.go
@@ -14,6 +14,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/transaction"
"gitlab.com/gitlab-org/gitaly/internal/helper"
@@ -33,7 +34,7 @@ func TestApplyGitattributesSuccess(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
infoPath := filepath.Join(testhelper.GitlabTestStoragePath(),
@@ -116,7 +117,7 @@ func TestApplyGitattributesWithTransaction(t *testing.T) {
Token: config.Config.Auth.Token,
}
- repo, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repo, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
for _, tc := range []struct {
@@ -233,7 +234,7 @@ func TestApplyGitattributesFailure(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
tests := []struct {
diff --git a/internal/gitaly/service/repository/archive_test.go b/internal/gitaly/service/repository/archive_test.go
index 00d130b3d..9dda7c0c4 100644
--- a/internal/gitaly/service/repository/archive_test.go
+++ b/internal/gitaly/service/repository/archive_test.go
@@ -12,6 +12,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -33,7 +34,7 @@ func TestGetArchiveSuccess(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
formats := []gitalypb.GetArchiveRequest_Format{
@@ -201,7 +202,7 @@ func TestGetArchiveWithLfsSuccess(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
// lfs-moar branch SHA
@@ -296,7 +297,7 @@ func TestGetArchiveFailure(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
commitID := "1a0b36b3cdad1d2ee32457c102a8c0b7056fa863"
@@ -431,7 +432,7 @@ func TestGetArchivePathInjection(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -498,7 +499,7 @@ func TestGetArchivePathInjection(t *testing.T) {
}
func TestGetArchiveEnv(t *testing.T) {
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
commitID := "1a0b36b3cdad1d2ee32457c102a8c0b7056fa863"
@@ -547,8 +548,8 @@ env | grep -E "^GL_|CORRELATION|GITALY_"`))
data, err := consumeArchive(stream)
require.NoError(t, err)
- require.Contains(t, string(data), "GL_REPOSITORY="+testhelper.GlRepository)
- require.Contains(t, string(data), "GL_PROJECT_PATH="+testhelper.GlProjectPath)
+ require.Contains(t, string(data), "GL_REPOSITORY="+gittest.GlRepository)
+ require.Contains(t, string(data), "GL_PROJECT_PATH="+gittest.GlProjectPath)
require.Contains(t, string(data), "GL_INTERNAL_CONFIG="+string(cfgData))
require.Contains(t, string(data), "GITALY_TLS="+string(tlsCfgData))
require.Contains(t, string(data), "CORRELATION_ID="+correlationID)
diff --git a/internal/gitaly/service/repository/backup_custom_hooks_test.go b/internal/gitaly/service/repository/backup_custom_hooks_test.go
index 28aaf2824..bc64d04e0 100644
--- a/internal/gitaly/service/repository/backup_custom_hooks_test.go
+++ b/internal/gitaly/service/repository/backup_custom_hooks_test.go
@@ -11,6 +11,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -28,7 +29,7 @@ func TestSuccessfullBackupCustomHooksRequest(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repoPath, err := locator.GetPath(testRepo)
@@ -78,7 +79,7 @@ func TestSuccessfullBackupCustomHooksSymlink(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repoPath, err := locator.GetPath(testRepo)
@@ -118,7 +119,7 @@ func TestSuccessfullBackupCustomHooksRequestWithNoHooks(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
backupRequest := &gitalypb.BackupCustomHooksRequest{Repository: testRepo}
diff --git a/internal/gitaly/service/repository/calculate_checksum_test.go b/internal/gitaly/service/repository/calculate_checksum_test.go
index f86e4a296..1c370c940 100644
--- a/internal/gitaly/service/repository/calculate_checksum_test.go
+++ b/internal/gitaly/service/repository/calculate_checksum_test.go
@@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -22,7 +23,7 @@ func TestSuccessfulCalculateChecksum(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
// Force the refs database of testRepo into a known state
@@ -80,7 +81,7 @@ func TestEmptyRepositoryCalculateChecksum(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- repo, _, cleanupFn := testhelper.InitBareRepo(t)
+ repo, _, cleanupFn := gittest.InitBareRepo(t)
defer cleanupFn()
request := &gitalypb.CalculateChecksumRequest{Repository: repo}
@@ -100,7 +101,7 @@ func TestBrokenRepositoryCalculateChecksum(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- repo, testRepoPath, cleanupFn := testhelper.InitBareRepo(t)
+ repo, testRepoPath, cleanupFn := gittest.InitBareRepo(t)
defer cleanupFn()
// Force an empty HEAD file
@@ -158,7 +159,7 @@ func TestInvalidRefsCalculateChecksum(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
// Force the refs database of testRepo into a known state
diff --git a/internal/gitaly/service/repository/cleanup_test.go b/internal/gitaly/service/repository/cleanup_test.go
index 377deed05..b23d2f5f8 100644
--- a/internal/gitaly/service/repository/cleanup_test.go
+++ b/internal/gitaly/service/repository/cleanup_test.go
@@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -22,7 +23,7 @@ func TestCleanupDeletesRefsLocks(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -90,7 +91,7 @@ func TestCleanupDeletesPackedRefsLock(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
// Force the packed-refs file to have an old time to test that even
@@ -160,13 +161,13 @@ func TestCleanupDeletesStaleWorktrees(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
req := &gitalypb.CleanupRequest{Repository: testRepo}
worktreeCheckoutPath := filepath.Join(testRepoPath, worktreePrefix, "test-worktree")
- testhelper.AddWorktree(t, testRepoPath, worktreeCheckoutPath)
+ gittest.AddWorktree(t, testRepoPath, worktreeCheckoutPath)
basePath := filepath.Join(testRepoPath, "worktrees")
worktreePath := filepath.Join(basePath, "test-worktree")
@@ -209,7 +210,7 @@ func TestCleanupDisconnectedWorktrees(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
worktreePath := filepath.Join(testRepoPath, worktreePrefix, worktreeName)
@@ -219,7 +220,7 @@ func TestCleanupDisconnectedWorktrees(t *testing.T) {
req := &gitalypb.CleanupRequest{Repository: testRepo}
- testhelper.AddWorktree(t, testRepoPath, worktreePath)
+ gittest.AddWorktree(t, testRepoPath, worktreePath)
ctx, cancel := testhelper.Context()
defer cancel()
@@ -232,7 +233,7 @@ func TestCleanupDisconnectedWorktrees(t *testing.T) {
"disconnecting worktree by removing work tree at %s should succeed", worktreePath,
)
- err = exec.Command(config.Config.Git.BinPath, testhelper.AddWorktreeArgs(testRepoPath, worktreePath)...).Run()
+ err = exec.Command(config.Config.Git.BinPath, gittest.AddWorktreeArgs(testRepoPath, worktreePath)...).Run()
require.Error(t, err, "creating a new work tree at the same path as a disconnected work tree should fail")
// cleanup should prune the disconnected worktree administrative files
@@ -242,7 +243,7 @@ func TestCleanupDisconnectedWorktrees(t *testing.T) {
// if the worktree administrative files are pruned, then we should be able
// to checkout another worktree at the same path
- testhelper.AddWorktree(t, testRepoPath, worktreePath)
+ gittest.AddWorktree(t, testRepoPath, worktreePath)
}
func TestCleanupFileLocks(t *testing.T) {
@@ -253,7 +254,7 @@ func TestCleanupFileLocks(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -316,7 +317,7 @@ func TestCleanupDeletesPackedRefsNew(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
req := &gitalypb.CleanupRequest{Repository: testRepo}
diff --git a/internal/gitaly/service/repository/clone_from_pool_internal_test.go b/internal/gitaly/service/repository/clone_from_pool_internal_test.go
index 92c40bc50..03efecfa3 100644
--- a/internal/gitaly/service/repository/clone_from_pool_internal_test.go
+++ b/internal/gitaly/service/repository/clone_from_pool_internal_test.go
@@ -21,8 +21,8 @@ import (
func NewTestObjectPool(t *testing.T) (*objectpool.ObjectPool, *gitalypb.Repository) {
storagePath := testhelper.GitlabTestStoragePath()
- relativePath := testhelper.NewTestObjectPoolName(t)
- repo := testhelper.CreateRepo(t, storagePath, relativePath)
+ relativePath := gittest.NewObjectPoolName(t)
+ repo := gittest.InitRepoDir(t, storagePath, relativePath)
pool, err := objectpool.NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), repo.GetStorageName(), relativePath)
require.NoError(t, err)
@@ -53,7 +53,7 @@ func TestCloneFromPoolInternal(t *testing.T) {
client, conn := repository.NewRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
pool, poolRepo := NewTestObjectPool(t)
diff --git a/internal/gitaly/service/repository/clone_from_pool_test.go b/internal/gitaly/service/repository/clone_from_pool_test.go
index 9cc677a3c..d71251908 100644
--- a/internal/gitaly/service/repository/clone_from_pool_test.go
+++ b/internal/gitaly/service/repository/clone_from_pool_test.go
@@ -27,7 +27,7 @@ func TestCloneFromPoolHTTP(t *testing.T) {
client, conn := repository.NewRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
pool, poolRepo := NewTestObjectPool(t)
diff --git a/internal/gitaly/service/repository/commit_graph_test.go b/internal/gitaly/service/repository/commit_graph_test.go
index f6a85ab56..8dc962f57 100644
--- a/internal/gitaly/service/repository/commit_graph_test.go
+++ b/internal/gitaly/service/repository/commit_graph_test.go
@@ -21,7 +21,7 @@ func TestWriteCommitGraph(t *testing.T) {
c, conn := newRepositoryClient(t, s)
defer conn.Close()
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
ctx, cancel := testhelper.Context()
@@ -54,7 +54,7 @@ func TestUpdateCommitGraph(t *testing.T) {
c, conn := newRepositoryClient(t, s)
defer conn.Close()
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
ctx, cancel := testhelper.Context()
diff --git a/internal/gitaly/service/repository/config_test.go b/internal/gitaly/service/repository/config_test.go
index 39db6e07d..efb26f842 100644
--- a/internal/gitaly/service/repository/config_test.go
+++ b/internal/gitaly/service/repository/config_test.go
@@ -7,6 +7,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -47,7 +48,7 @@ func TestDeleteConfig(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
for _, k := range tc.addKeys {
@@ -112,7 +113,7 @@ func TestSetConfig(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
_, err := client.SetConfig(ctx, &gitalypb.SetConfigRequest{Repository: testRepo, Entries: tc.entries})
diff --git a/internal/gitaly/service/repository/create_bundle_test.go b/internal/gitaly/service/repository/create_bundle_test.go
index f29fbcabb..c54e307c7 100644
--- a/internal/gitaly/service/repository/create_bundle_test.go
+++ b/internal/gitaly/service/repository/create_bundle_test.go
@@ -29,7 +29,7 @@ func TestSuccessfulCreateBundleRequest(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
// create a work tree with a HEAD pointing to a commit that is missing.
diff --git a/internal/gitaly/service/repository/create_from_bundle_test.go b/internal/gitaly/service/repository/create_from_bundle_test.go
index b9b130ebb..2dd3b948c 100644
--- a/internal/gitaly/service/repository/create_from_bundle_test.go
+++ b/internal/gitaly/service/repository/create_from_bundle_test.go
@@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/tempdir"
@@ -30,7 +31,7 @@ func TestServer_CreateRepositoryFromBundle_successful(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
tmpdir, err := tempdir.New(ctx, testRepo, locator)
@@ -156,7 +157,7 @@ func TestServer_CreateRepositoryFromBundle_failed_existing_directory(t *testing.
serverSocketPath, stop := runRepoServer(t, locator)
defer stop()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
client, conn := newRepositoryClient(t, serverSocketPath)
diff --git a/internal/gitaly/service/repository/create_from_snapshot_test.go b/internal/gitaly/service/repository/create_from_snapshot_test.go
index 87746f853..97c8fa7b5 100644
--- a/internal/gitaly/service/repository/create_from_snapshot_test.go
+++ b/internal/gitaly/service/repository/create_from_snapshot_test.go
@@ -11,6 +11,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/archive"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -69,7 +70,7 @@ func createFromSnapshot(t *testing.T, req *gitalypb.CreateRepositoryFromSnapshot
}
func TestCreateRepositoryFromSnapshotSuccess(t *testing.T) {
- _, sourceRepoPath, cleanTestRepo := testhelper.NewTestRepo(t)
+ _, sourceRepoPath, cleanTestRepo := gittest.CloneRepo(t)
defer cleanTestRepo()
// Ensure these won't be in the archive
@@ -118,7 +119,7 @@ func TestCreateRepositoryFromSnapshotSuccess(t *testing.T) {
}
func TestCreateRepositoryFromSnapshotFailsIfRepositoryExists(t *testing.T) {
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
req := &gitalypb.CreateRepositoryFromSnapshotRequest{Repository: testRepo}
@@ -129,7 +130,7 @@ func TestCreateRepositoryFromSnapshotFailsIfRepositoryExists(t *testing.T) {
}
func TestCreateRepositoryFromSnapshotFailsIfBadURL(t *testing.T) {
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
cleanupFn() // free up the destination dir for use
req := &gitalypb.CreateRepositoryFromSnapshotRequest{
@@ -144,7 +145,7 @@ func TestCreateRepositoryFromSnapshotFailsIfBadURL(t *testing.T) {
}
func TestCreateRepositoryFromSnapshotBadRequests(t *testing.T) {
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
cleanupFn() // free up the destination dir for use
testCases := []struct {
@@ -198,7 +199,7 @@ func TestCreateRepositoryFromSnapshotBadRequests(t *testing.T) {
}
func TestCreateRepositoryFromSnapshotHandlesMalformedResponse(t *testing.T) {
- testRepo, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
require.NoError(t, os.Remove(filepath.Join(repoPath, "config")))
diff --git a/internal/gitaly/service/repository/create_from_url_test.go b/internal/gitaly/service/repository/create_from_url_test.go
index 43284c70d..ae60f10fc 100644
--- a/internal/gitaly/service/repository/create_from_url_test.go
+++ b/internal/gitaly/service/repository/create_from_url_test.go
@@ -34,7 +34,7 @@ func TestSuccessfulCreateRepositoryFromURLRequest(t *testing.T) {
StorageName: testhelper.DefaultStorageName,
}
- _, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ _, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
user := "username123"
diff --git a/internal/gitaly/service/repository/create_test.go b/internal/gitaly/service/repository/create_test.go
index 1b7d2f7f0..c710d36b8 100644
--- a/internal/gitaly/service/repository/create_test.go
+++ b/internal/gitaly/service/repository/create_test.go
@@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -117,7 +118,7 @@ func TestCreateRepositoryIdempotent(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
refsBefore := strings.Split(string(testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "for-each-ref")), "\n")
diff --git a/internal/gitaly/service/repository/fetch_remote_test.go b/internal/gitaly/service/repository/fetch_remote_test.go
index b2f36f864..4d5450aa1 100644
--- a/internal/gitaly/service/repository/fetch_remote_test.go
+++ b/internal/gitaly/service/repository/fetch_remote_test.go
@@ -51,7 +51,7 @@ func TestFetchRemoteSuccess(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
cloneRepo, cloneRepoPath := copyRepoWithNewRemote(t, testRepo, locator, "my-remote")
@@ -86,7 +86,7 @@ func TestFetchRemote_withDefaultRefmaps(t *testing.T) {
gitCmdFactory := git.NewExecCommandFactory(config.Config)
- sourceRepoProto, sourceRepoPath, cleanup := testhelper.NewTestRepo(t)
+ sourceRepoProto, sourceRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
sourceRepo := localrepo.New(gitCmdFactory, sourceRepoProto, config.Config)
@@ -132,7 +132,7 @@ func TestFetchRemote_prune(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- sourceRepo, sourceRepoPath, cleanup := testhelper.NewTestRepo(t)
+ sourceRepo, sourceRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
port, stopGitServer := gittest.GitServer(t, config.Config, sourceRepoPath, nil)
@@ -238,7 +238,7 @@ func TestFetchRemote_prune(t *testing.T) {
}
func TestFetchRemoteFailure(t *testing.T) {
- repo, _, cleanup := testhelper.NewTestRepo(t)
+ repo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
serverSocketPath, stop := runRepoServer(t, config.NewLocator(config.Config))
@@ -426,7 +426,7 @@ func TestFetchRemoteOverHTTP(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.description, func(t *testing.T) {
- forkedRepo, forkedRepoPath, forkedRepoCleanup := testhelper.NewTestRepo(t)
+ forkedRepo, forkedRepoPath, forkedRepoCleanup := gittest.CloneRepo(t)
defer forkedRepoCleanup()
s, remoteURL := remoteHTTPServer(t, "my-repo", tc.httpToken)
@@ -478,7 +478,7 @@ func TestFetchRemoteOverHTTPWithRedirect(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
req := &gitalypb.FetchRemoteRequest{
@@ -511,7 +511,7 @@ func TestFetchRemoteOverHTTPWithTimeout(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
req := &gitalypb.FetchRemoteRequest{
diff --git a/internal/gitaly/service/repository/fetch_test.go b/internal/gitaly/service/repository/fetch_test.go
index dbe74c69b..d22cdb51b 100644
--- a/internal/gitaly/service/repository/fetch_test.go
+++ b/internal/gitaly/service/repository/fetch_test.go
@@ -320,7 +320,7 @@ func TestFetchFullServerRequiresAuthentication(t *testing.T) {
}
func newTestRepo(t *testing.T, locator storage.Locator, relativePath string) (*gitalypb.Repository, string, func()) {
- _, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ _, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
repo := &gitalypb.Repository{StorageName: "default", RelativePath: relativePath}
diff --git a/internal/gitaly/service/repository/fork_test.go b/internal/gitaly/service/repository/fork_test.go
index 56a5a23a2..6da4cfe97 100644
--- a/internal/gitaly/service/repository/fork_test.go
+++ b/internal/gitaly/service/repository/fork_test.go
@@ -8,6 +8,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/service/repository"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -66,7 +67,7 @@ func TestSuccessfulCreateForkRequest(t *testing.T) {
md := testhelper.GitalyServersMetadata(t, serverSocketPath)
ctx := metadata.NewOutgoingContext(ctxOuter, md)
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
forkedRepo := &gitalypb.Repository{
@@ -118,7 +119,7 @@ func TestFailedCreateForkRequestDueToExistingTarget(t *testing.T) {
md := testhelper.GitalyServersMetadata(t, serverSocketPath)
ctx := metadata.NewOutgoingContext(ctxOuter, md)
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
diff --git a/internal/gitaly/service/repository/fsck_test.go b/internal/gitaly/service/repository/fsck_test.go
index 03560cdf8..fa3f05adc 100644
--- a/internal/gitaly/service/repository/fsck_test.go
+++ b/internal/gitaly/service/repository/fsck_test.go
@@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -24,7 +25,7 @@ func TestFsckSuccess(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
c, err := client.Fsck(ctx, &gitalypb.FsckRequest{Repository: testRepo})
@@ -44,7 +45,7 @@ func TestFsckFailureSeverelyBrokenRepo(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
// This makes the repo severely broken so that `git` does not identify it as a
@@ -71,7 +72,7 @@ func TestFsckFailureSlightlyBrokenRepo(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
// This makes the repo slightly broken so that `git` still identify it as a
diff --git a/internal/gitaly/service/repository/gc_test.go b/internal/gitaly/service/repository/gc_test.go
index 704ec543c..7ef7b432f 100644
--- a/internal/gitaly/service/repository/gc_test.go
+++ b/internal/gitaly/service/repository/gc_test.go
@@ -38,7 +38,7 @@ func TestGarbageCollectCommitGraph(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -72,7 +72,7 @@ func TestGarbageCollectSuccess(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
tests := []struct {
@@ -134,7 +134,7 @@ func TestGarbageCollectWithPrune(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
blobHashes := gittest.WriteBlobs(t, repoPath, 3)
@@ -190,7 +190,7 @@ func TestGarbageCollectLogStatistics(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
_, err := client.GarbageCollect(ctx, &gitalypb.GarbageCollectRequest{Repository: testRepo})
@@ -207,7 +207,7 @@ func TestGarbageCollectDeletesRefsLocks(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -256,7 +256,7 @@ func TestGarbageCollectFailure(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
tests := []struct {
@@ -287,7 +287,7 @@ func TestCleanupInvalidKeepAroundRefs(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
// Make the directory, so we can create random reflike things in it
@@ -386,7 +386,7 @@ func TestGarbageCollectDeltaIslands(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
diff --git a/internal/gitaly/service/repository/info_attributes_test.go b/internal/gitaly/service/repository/info_attributes_test.go
index bafb9f6c9..1bfd5ed92 100644
--- a/internal/gitaly/service/repository/info_attributes_test.go
+++ b/internal/gitaly/service/repository/info_attributes_test.go
@@ -8,6 +8,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -22,7 +23,7 @@ func TestGetInfoAttributesExisting(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
infoPath := filepath.Join(repoPath, "info")
@@ -58,7 +59,7 @@ func TestGetInfoAttributesNonExisting(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
request := &gitalypb.GetInfoAttributesRequest{Repository: testRepo}
diff --git a/internal/gitaly/service/repository/license_test.go b/internal/gitaly/service/repository/license_test.go
index bd6ad2156..6df576e29 100644
--- a/internal/gitaly/service/repository/license_test.go
+++ b/internal/gitaly/service/repository/license_test.go
@@ -5,6 +5,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -18,7 +19,7 @@ func TestSuccessfulFindLicenseRequest(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
req := &gitalypb.FindLicenseRequest{Repository: testRepo}
diff --git a/internal/gitaly/service/repository/merge_base_test.go b/internal/gitaly/service/repository/merge_base_test.go
index 8f394bc48..47b1819be 100644
--- a/internal/gitaly/service/repository/merge_base_test.go
+++ b/internal/gitaly/service/repository/merge_base_test.go
@@ -4,6 +4,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -18,7 +19,7 @@ func TestSuccessfulFindFindMergeBaseRequest(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -95,7 +96,7 @@ func TestFailedFindMergeBaseRequestDueToValidations(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
diff --git a/internal/gitaly/service/repository/midx_test.go b/internal/gitaly/service/repository/midx_test.go
index cef48cc8f..d531e8fda 100644
--- a/internal/gitaly/service/repository/midx_test.go
+++ b/internal/gitaly/service/repository/midx_test.go
@@ -28,7 +28,7 @@ func TestMidxWrite(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -61,7 +61,7 @@ func TestMidxRewrite(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -96,7 +96,7 @@ func TestMidxRepack(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -146,7 +146,7 @@ func TestMidxRepackExpire(t *testing.T) {
for _, packsAdded := range []int{3, 5, 11, 20} {
t.Run(fmt.Sprintf("Test repack expire with %d added packs", packsAdded),
func(t *testing.T) {
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
diff --git a/internal/gitaly/service/repository/optimize_test.go b/internal/gitaly/service/repository/optimize_test.go
index d56ddf856..1c504366f 100644
--- a/internal/gitaly/service/repository/optimize_test.go
+++ b/internal/gitaly/service/repository/optimize_test.go
@@ -40,7 +40,7 @@ func getNewestPackfileModtime(t *testing.T, repoPath string) time.Time {
}
func TestOptimizeRepository(t *testing.T) {
- testRepo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "repack", "-A", "-b")
@@ -96,7 +96,7 @@ func TestOptimizeRepository(t *testing.T) {
require.Equal(t, getNewestPackfileModtime(t, testRepoPath), newestsPackfileTime, "there should not have been a new packfile created")
- testRepo, testRepoPath, cleanupBare := testhelper.InitBareRepo(t)
+ testRepo, testRepoPath, cleanupBare := gittest.InitBareRepo(t)
defer cleanupBare()
blobs := 10
@@ -139,7 +139,7 @@ func TestOptimizeRepository(t *testing.T) {
}
func TestOptimizeRepositoryValidation(t *testing.T) {
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
testCases := []struct {
diff --git a/internal/gitaly/service/repository/raw_changes_test.go b/internal/gitaly/service/repository/raw_changes_test.go
index e478ecb6e..a51d42b20 100644
--- a/internal/gitaly/service/repository/raw_changes_test.go
+++ b/internal/gitaly/service/repository/raw_changes_test.go
@@ -22,7 +22,7 @@ func TestGetRawChanges(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -140,7 +140,7 @@ func TestGetRawChangesSpecialCharacters(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -186,7 +186,7 @@ func TestGetRawChangesFailures(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -249,7 +249,7 @@ func TestGetRawChangesManyFiles(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -278,7 +278,7 @@ func TestGetRawChangesMappingOperations(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
@@ -330,7 +330,7 @@ func TestGetRawChangesInvalidUTF8Paths(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
const (
diff --git a/internal/gitaly/service/repository/rebase_in_progress_test.go b/internal/gitaly/service/repository/rebase_in_progress_test.go
index 5cfea4721..46062b9ea 100644
--- a/internal/gitaly/service/repository/rebase_in_progress_test.go
+++ b/internal/gitaly/service/repository/rebase_in_progress_test.go
@@ -8,6 +8,7 @@ import (
"time"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -22,7 +23,7 @@ func TestSuccessfulIsRebaseInProgressRequest(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo1, testRepo1Path, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo1, testRepo1Path, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testhelper.MustRunCommand(t, nil, "git", "-C", testRepo1Path, "worktree", "add", "--detach", filepath.Join(testRepo1Path, worktreePrefix, fmt.Sprintf("%s-1", rebaseWorktreePrefix)), "master")
@@ -40,7 +41,7 @@ func TestSuccessfulIsRebaseInProgressRequest(t *testing.T) {
testhelper.MustRunCommand(t, nil, "git", "-C", testRepo1Path, "worktree", "add", "--detach", oldPath, "master")
os.Chtimes(oldPath, time.Now(), time.Now().Add(-16*time.Minute))
- testRepo2, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo2, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
diff --git a/internal/gitaly/service/repository/remove_test.go b/internal/gitaly/service/repository/remove_test.go
index c25d0e4eb..1c5e22e63 100644
--- a/internal/gitaly/service/repository/remove_test.go
+++ b/internal/gitaly/service/repository/remove_test.go
@@ -4,6 +4,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -17,7 +18,7 @@ func TestRemoveRepository(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
diff --git a/internal/gitaly/service/repository/rename_test.go b/internal/gitaly/service/repository/rename_test.go
index 4e1c9c343..1efe13275 100644
--- a/internal/gitaly/service/repository/rename_test.go
+++ b/internal/gitaly/service/repository/rename_test.go
@@ -21,7 +21,7 @@ func TestRenameRepositorySuccess(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
req := &gitalypb.RenameRepositoryRequest{Repository: testRepo, RelativePath: "a-new-location"}
@@ -51,10 +51,10 @@ func TestRenameRepositoryDestinationExists(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- destinationRepo, destinationRepoPath, cleanupDestinationRepo := testhelper.NewTestRepo(t)
+ destinationRepo, destinationRepoPath, cleanupDestinationRepo := gittest.CloneRepo(t)
defer cleanupDestinationRepo()
_, sha := gittest.CreateCommitOnNewBranch(t, destinationRepoPath)
@@ -79,7 +79,7 @@ func TestRenameRepositoryInvalidRequest(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
diff --git a/internal/gitaly/service/repository/repack_test.go b/internal/gitaly/service/repository/repack_test.go
index a202703a8..cf81b4ab5 100644
--- a/internal/gitaly/service/repository/repack_test.go
+++ b/internal/gitaly/service/repository/repack_test.go
@@ -29,7 +29,7 @@ func TestRepackIncrementalSuccess(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
packPath := filepath.Join(testhelper.GitlabTestStoragePath(), testRepo.GetRelativePath(), "objects", "pack")
@@ -70,7 +70,7 @@ func TestRepackIncrementalCollectLogStatistics(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
_, err := client.RepackIncremental(ctx, &gitalypb.RepackIncrementalRequest{Repository: testRepo})
@@ -87,7 +87,7 @@ func TestRepackLocal(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, repoPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ testRepo, repoPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
commiterArgs := []string{"-c", "user.name=Scrooge McDuck", "-c", "user.email=scrooge@mcduck.com"}
@@ -156,7 +156,7 @@ func TestRepackFullSuccess(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
tests := []struct {
@@ -223,7 +223,7 @@ func TestRepackFullCollectLogStatistics(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
_, err := client.RepackFull(ctx, &gitalypb.RepackFullRequest{Repository: testRepo})
@@ -295,7 +295,7 @@ func TestRepackFullDeltaIslands(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
diff --git a/internal/gitaly/service/repository/replicate_test.go b/internal/gitaly/service/repository/replicate_test.go
index 115a37ae5..79de982ab 100644
--- a/internal/gitaly/service/repository/replicate_test.go
+++ b/internal/gitaly/service/repository/replicate_test.go
@@ -52,7 +52,7 @@ func TestReplicateRepository(t *testing.T) {
serverSocketPath, clean := runFullServer(t)
defer clean()
- testRepo, testRepoPath, cleanupRepo := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupRepo := gittest.CloneRepo(t)
defer cleanupRepo()
// create a loose object to ensure snapshot replication is used
@@ -247,10 +247,10 @@ func TestReplicateRepository_BadRepository(t *testing.T) {
},
}
- sourceRepo, _, cleanupRepo := testhelper.NewTestRepo(t)
+ sourceRepo, _, cleanupRepo := gittest.CloneRepo(t)
defer cleanupRepo()
- targetRepo := testhelper.NewTestRepoTo(t, targetStorageRoot, sourceRepo.RelativePath)
+ targetRepo := gittest.CloneRepoAtStorageRoot(t, targetStorageRoot, sourceRepo.RelativePath)
targetRepo.StorageName = "target"
var invalidRepos []*gitalypb.Repository
@@ -328,7 +328,7 @@ func TestReplicateRepository_FailedFetchInternalRemote(t *testing.T) {
locator := config.NewLocator(config.Config)
- testRepo, _, cleanupRepo := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupRepo := gittest.CloneRepo(t)
defer cleanupRepo()
config.Config.SocketPath = serverSocketPath
diff --git a/internal/gitaly/service/repository/repository_test.go b/internal/gitaly/service/repository/repository_test.go
index 18a5a932b..dc24e2d5e 100644
--- a/internal/gitaly/service/repository/repository_test.go
+++ b/internal/gitaly/service/repository/repository_test.go
@@ -6,6 +6,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/helper"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -33,7 +34,7 @@ func TestRepositoryExists(t *testing.T) {
serverSocketPath, stop := runRepoServer(t, locator, testhelper.WithStorages([]string{"default", "other", "broken"}))
defer stop()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
client, conn := newRepositoryClient(t, serverSocketPath)
@@ -130,7 +131,7 @@ func TestSuccessfulHasLocalBranches(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
emptyRepoName := "empty-repo.git"
diff --git a/internal/gitaly/service/repository/restore_custom_hooks_test.go b/internal/gitaly/service/repository/restore_custom_hooks_test.go
index b3f554307..30536f76d 100644
--- a/internal/gitaly/service/repository/restore_custom_hooks_test.go
+++ b/internal/gitaly/service/repository/restore_custom_hooks_test.go
@@ -7,6 +7,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -25,7 +26,7 @@ func TestSuccessfullRestoreCustomHooksRequest(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
@@ -90,7 +91,7 @@ func TestFailedRestoreCustomHooksDueToBadTar(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
diff --git a/internal/gitaly/service/repository/search_files_test.go b/internal/gitaly/service/repository/search_files_test.go
index 522e1bc13..eaca9fcc8 100644
--- a/internal/gitaly/service/repository/search_files_test.go
+++ b/internal/gitaly/service/repository/search_files_test.go
@@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/transaction"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
@@ -90,7 +91,7 @@ func TestSearchFilesByContentSuccessful(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -163,7 +164,7 @@ func TestSearchFilesByContentLargeFile(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepoWithWorktree(t)
defer cleanupFn()
committerName := "Scrooge McDuck"
@@ -216,7 +217,7 @@ func TestSearchFilesByContentLargeFile(t *testing.T) {
func TestSearchFilesByContentFailure(t *testing.T) {
server := NewServer(config.Config, RubyServer, config.NewLocator(config.Config), transaction.NewManager(config.Config), git.NewExecCommandFactory(config.Config))
- testRepo, _, cleanupRepo := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupRepo := gittest.CloneRepo(t)
defer cleanupRepo()
testCases := []struct {
@@ -280,7 +281,7 @@ func TestSearchFilesByNameSuccessful(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
diff --git a/internal/gitaly/service/repository/size_test.go b/internal/gitaly/service/repository/size_test.go
index 9ba171edb..c25e81083 100644
--- a/internal/gitaly/service/repository/size_test.go
+++ b/internal/gitaly/service/repository/size_test.go
@@ -4,6 +4,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -22,7 +23,7 @@ func TestSuccessfulRepositorySizeRequest(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- repo, _, cleanup := testhelper.NewTestRepo(t)
+ repo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
request := &gitalypb.RepositorySizeRequest{Repository: repo}
@@ -77,7 +78,7 @@ func TestSuccessfulGetObjectDirectorySizeRequest(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
testRepo.GitObjectDirectory = "objects/"
diff --git a/internal/gitaly/service/repository/snapshot_test.go b/internal/gitaly/service/repository/snapshot_test.go
index a274f6ee8..3ce7b4c65 100644
--- a/internal/gitaly/service/repository/snapshot_test.go
+++ b/internal/gitaly/service/repository/snapshot_test.go
@@ -58,7 +58,7 @@ func touch(t *testing.T, format string, args ...interface{}) {
}
func TestGetSnapshotSuccess(t *testing.T) {
- testRepo, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
// Ensure certain files exist in the test repo.
@@ -104,14 +104,14 @@ func TestGetSnapshotWithDedupe(t *testing.T) {
{
desc: "absolute path",
alternatePathFunc: func(*testing.T, string) string {
- return filepath.Join(testhelper.GitlabTestStoragePath(), testhelper.NewTestObjectPoolName(t), "objects")
+ return filepath.Join(testhelper.GitlabTestStoragePath(), gittest.NewObjectPoolName(t), "objects")
},
},
{
desc: "relative path",
alternatePathFunc: func(t *testing.T, objDir string) string {
altObjDir, err := filepath.Rel(objDir, filepath.Join(
- testhelper.GitlabTestStoragePath(), testhelper.NewTestObjectPoolName(t), "objects",
+ testhelper.GitlabTestStoragePath(), gittest.NewObjectPoolName(t), "objects",
))
require.NoError(t, err)
return altObjDir
@@ -119,7 +119,7 @@ func TestGetSnapshotWithDedupe(t *testing.T) {
},
} {
t.Run(tc.desc, func(t *testing.T) {
- testRepo, repoPath, cleanup := testhelper.NewTestRepoWithWorktree(t)
+ testRepo, repoPath, cleanup := gittest.CloneRepoWithWorktree(t)
defer cleanup()
ctx, cancel := testhelper.Context()
@@ -173,7 +173,7 @@ func TestGetSnapshotWithDedupe(t *testing.T) {
}
func TestGetSnapshotWithDedupeSoftFailures(t *testing.T) {
- testRepo, repoPath, cleanup := testhelper.NewTestRepoWithWorktree(t)
+ testRepo, repoPath, cleanup := gittest.CloneRepoWithWorktree(t)
defer cleanup()
locator := config.NewLocator(config.Config)
@@ -238,7 +238,7 @@ func copyRepoUsingSnapshot(t *testing.T, locator storage.Locator, source *gitaly
srv := httptest.NewServer(&tarTesthandler{tarData: bytes.NewBuffer(data), secret: secret})
defer srv.Close()
- repoCopy, repoCopyPath, cleanupCopy := testhelper.NewTestRepo(t)
+ repoCopy, repoCopyPath, cleanupCopy := gittest.CloneRepo(t)
// Delete the repository so we can re-use the path
require.NoError(t, os.RemoveAll(repoCopyPath))
@@ -256,7 +256,7 @@ func copyRepoUsingSnapshot(t *testing.T, locator storage.Locator, source *gitaly
}
func TestGetSnapshotFailsIfRepositoryMissing(t *testing.T) {
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
cleanupFn() // Remove the repo
req := &gitalypb.GetSnapshotRequest{Repository: testRepo}
@@ -266,7 +266,7 @@ func TestGetSnapshotFailsIfRepositoryMissing(t *testing.T) {
}
func TestGetSnapshotFailsIfRepositoryContainsSymlink(t *testing.T) {
- testRepo, repoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, repoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
// Make packed-refs into a symlink to break GetSnapshot()
diff --git a/internal/gitaly/service/repository/squash_in_progress_test.go b/internal/gitaly/service/repository/squash_in_progress_test.go
index 429efbfba..2c71e5612 100644
--- a/internal/gitaly/service/repository/squash_in_progress_test.go
+++ b/internal/gitaly/service/repository/squash_in_progress_test.go
@@ -5,6 +5,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -19,12 +20,12 @@ func TestSuccessfulIsSquashInProgressRequest(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo1, testRepo1Path, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo1, testRepo1Path, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testhelper.MustRunCommand(t, nil, "git", "-C", testRepo1Path, "worktree", "add", "--detach", filepath.Join(testRepo1Path, worktreePrefix, "squash-1"), "master")
- testRepo2, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo2, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
diff --git a/internal/gitaly/service/repository/write_ref_test.go b/internal/gitaly/service/repository/write_ref_test.go
index 6c76b5648..5ae591410 100644
--- a/internal/gitaly/service/repository/write_ref_test.go
+++ b/internal/gitaly/service/repository/write_ref_test.go
@@ -6,6 +6,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -20,7 +21,7 @@ func TestWriteRefSuccessful(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
@@ -87,7 +88,7 @@ func TestWriteRefValidationError(t *testing.T) {
client, conn := newRepositoryClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
testCases := []struct {
diff --git a/internal/gitaly/service/smarthttp/inforefs_test.go b/internal/gitaly/service/smarthttp/inforefs_test.go
index b53704f1a..94c5b288f 100644
--- a/internal/gitaly/service/smarthttp/inforefs_test.go
+++ b/internal/gitaly/service/smarthttp/inforefs_test.go
@@ -32,7 +32,7 @@ func TestSuccessfulInfoRefsUploadPack(t *testing.T) {
serverSocketPath, stop := runSmartHTTPServer(t, config.Config)
defer stop()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rpcRequest := &gitalypb.InfoRefsRequest{Repository: testRepo}
@@ -55,7 +55,7 @@ func TestSuccessfulInfoRefsUploadWithPartialClone(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
request := &gitalypb.InfoRefsRequest{
@@ -77,7 +77,7 @@ func TestSuccessfulInfoRefsUploadPackWithGitConfigOptions(t *testing.T) {
serverSocketPath, stop := runSmartHTTPServer(t, config.Config)
defer stop()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
// transfer.hideRefs=refs will hide every ref that info-refs would normally
@@ -105,7 +105,7 @@ func TestSuccessfulInfoRefsUploadPackWithGitProtocol(t *testing.T) {
serverSocketPath, stop := runSmartHTTPServer(t, config.Config)
defer stop()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rpcRequest := &gitalypb.InfoRefsRequest{
@@ -157,7 +157,7 @@ func TestSuccessfulInfoRefsReceivePack(t *testing.T) {
client, conn := newSmartHTTPClient(t, serverSocketPath, config.Config.Auth.Token)
defer conn.Close()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rpcRequest := &gitalypb.InfoRefsRequest{Repository: testRepo}
@@ -190,13 +190,13 @@ func TestObjectPoolRefAdvertisementHiding(t *testing.T) {
client, conn := newSmartHTTPClient(t, serverSocketPath, config.Config.Auth.Token)
defer conn.Close()
- repo, _, cleanupFn := testhelper.NewTestRepo(t)
+ repo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
defer cancel()
- pool, err := objectpool.NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), repo.GetStorageName(), testhelper.NewTestObjectPoolName(t))
+ pool, err := objectpool.NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), repo.GetStorageName(), gittest.NewObjectPoolName(t))
require.NoError(t, err)
require.NoError(t, pool.Create(ctx, repo))
@@ -300,7 +300,7 @@ func TestCacheInfoRefsUploadPack(t *testing.T) {
serverSocketPath, stop := runSmartHTTPServer(t, config.Config)
defer stop()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
rpcRequest := &gitalypb.InfoRefsRequest{Repository: testRepo}
diff --git a/internal/gitaly/service/smarthttp/receive_pack_test.go b/internal/gitaly/service/smarthttp/receive_pack_test.go
index d15a669ab..a1e38af99 100644
--- a/internal/gitaly/service/smarthttp/receive_pack_test.go
+++ b/internal/gitaly/service/smarthttp/receive_pack_test.go
@@ -51,7 +51,7 @@ func TestSuccessfulReceivePackRequest(t *testing.T) {
serverSocketPath, stop := runSmartHTTPServer(t, config.Config)
defer stop()
- repo, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repo, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
client, conn := newSmartHTTPClient(t, serverSocketPath, config.Config.Auth.Token)
@@ -118,7 +118,7 @@ func TestSuccessfulReceivePackRequestWithGitProtocol(t *testing.T) {
serverSocketPath, stop := runSmartHTTPServer(t, config.Config)
defer stop()
- repo, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repo, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
client, conn := newSmartHTTPClient(t, serverSocketPath, config.Config.Auth.Token)
@@ -145,7 +145,7 @@ func TestFailedReceivePackRequestWithGitOpts(t *testing.T) {
serverSocketPath, stop := runSmartHTTPServer(t, config.Config)
defer stop()
- repo, _, cleanup := testhelper.NewTestRepo(t)
+ repo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
client, conn := newSmartHTTPClient(t, serverSocketPath, config.Config.Auth.Token)
@@ -182,7 +182,7 @@ func TestFailedReceivePackRequestDueToHooksFailure(t *testing.T) {
serverSocketPath, stop := runSmartHTTPServer(t, config.Config)
defer stop()
- repo, _, cleanup := testhelper.NewTestRepo(t)
+ repo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
client, conn := newSmartHTTPClient(t, serverSocketPath, config.Config.Auth.Token)
@@ -230,7 +230,7 @@ type pushData struct {
}
func newTestPush(t *testing.T, fileContents []byte) *pushData {
- _, repoPath, localCleanup := testhelper.NewTestRepoWithWorktree(t)
+ _, repoPath, localCleanup := gittest.CloneRepoWithWorktree(t)
defer localCleanup()
oldHead, newHead := createCommit(t, repoPath, fileContents)
@@ -317,7 +317,7 @@ func TestFailedReceivePackRequestDueToValidationError(t *testing.T) {
}
func TestInvalidTimezone(t *testing.T) {
- _, localRepoPath, localCleanup := testhelper.NewTestRepoWithWorktree(t)
+ _, localRepoPath, localCleanup := gittest.CloneRepoWithWorktree(t)
defer localCleanup()
head := text.ChompBytes(testhelper.MustRunCommand(t, nil, "git", "-C", localRepoPath, "rev-parse", "HEAD"))
@@ -346,7 +346,7 @@ func TestInvalidTimezone(t *testing.T) {
socket, stop := runSmartHTTPServer(t, config.Config)
defer stop()
- repo, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repo, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
client, conn := newSmartHTTPClient(t, socket, config.Config.Auth.Token)
@@ -402,7 +402,7 @@ func TestPostReceivePackToHooks(t *testing.T) {
}(config.Config)
config.Config.GitlabShell.Dir = tempGitlabShellDir
- repo, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ repo, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
push := newTestPush(t, nil)
@@ -491,7 +491,7 @@ func testPostReceiveWithTransactionsViaPraefect(t *testing.T, ctx context.Contex
gitlabUser := "gitlab_user-1234"
gitlabPassword := "gitlabsecret9887"
- repo, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repo, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
opts := testhelper.GitlabTestServerOptions{
@@ -613,7 +613,7 @@ func TestPostReceiveWithReferenceTransactionHook(t *testing.T) {
stream, err := client.PostReceivePack(ctx)
require.NoError(t, err)
- repo, _, cleanup := testhelper.NewTestRepo(t)
+ repo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
request := &gitalypb.PostReceivePackRequest{Repository: repo, GlId: "key-1234", GlRepository: "some_repo"}
@@ -630,7 +630,7 @@ func TestPostReceiveWithReferenceTransactionHook(t *testing.T) {
stream, err := client.PostReceivePack(ctx)
require.NoError(t, err)
- repo, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repo, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
// Create a new branch which we're about to delete. We also pack references because
diff --git a/internal/gitaly/service/smarthttp/upload_pack_test.go b/internal/gitaly/service/smarthttp/upload_pack_test.go
index 61504c7aa..8990e9bc9 100644
--- a/internal/gitaly/service/smarthttp/upload_pack_test.go
+++ b/internal/gitaly/service/smarthttp/upload_pack_test.go
@@ -44,7 +44,7 @@ func testSuccessfulUploadPackRequest(t *testing.T, ctx context.Context) {
)
defer stop()
- _, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ _, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
storagePath := testhelper.GitlabTestStoragePath()
@@ -116,7 +116,7 @@ func testUploadPackRequestWithGitConfigOptions(t *testing.T, ctx context.Context
serverSocketPath, stop := runSmartHTTPServer(t, config.Config)
defer stop()
- _, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ _, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
storagePath := testhelper.GitlabTestStoragePath()
@@ -188,7 +188,7 @@ func testUploadPackRequestWithGitProtocol(t *testing.T, ctx context.Context) {
serverSocketPath, stop := runSmartHTTPServer(t, config.Config)
defer stop()
- _, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ _, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
storagePath := testhelper.GitlabTestStoragePath()
@@ -234,7 +234,7 @@ func testSuccessfulUploadPackDeepenRequest(t *testing.T, ctx context.Context) {
serverSocketPath, stop := runSmartHTTPServer(t, config.Config)
defer stop()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
requestBody := &bytes.Buffer{}
@@ -276,7 +276,7 @@ func TestUploadPackWithPackObjectsHook(t *testing.T) {
serverSocketPath, stop := runSmartHTTPServer(t, config.Config)
defer stop()
- repo, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repo, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
oldHead := bytes.TrimSpace(testhelper.MustRunCommand(t, nil, "git", "-C", repoPath, "rev-parse", "master~"))
@@ -406,7 +406,7 @@ func testUploadPackRequestForPartialCloneSuccess(t *testing.T, ctx context.Conte
)
defer stop()
- _, testRepoPath, cleanup := testhelper.NewTestRepo(t)
+ _, testRepoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
storagePath := testhelper.GitlabTestStoragePath()
diff --git a/internal/gitaly/service/ssh/receive_pack_test.go b/internal/gitaly/service/ssh/receive_pack_test.go
index 0a88d15e5..ca6f40013 100644
--- a/internal/gitaly/service/ssh/receive_pack_test.go
+++ b/internal/gitaly/service/ssh/receive_pack_test.go
@@ -32,7 +32,7 @@ func TestFailedReceivePackRequestDueToValidationError(t *testing.T) {
client, conn := newSSHClient(t, serverSocketPath)
defer conn.Close()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
tests := []struct {
@@ -207,10 +207,10 @@ func TestObjectPoolRefAdvertisementHidingSSH(t *testing.T) {
stream, err := client.SSHReceivePack(ctx)
require.NoError(t, err)
- repo, _, cleanupFn := testhelper.NewTestRepo(t)
+ repo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- pool, err := objectpool.NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), repo.GetStorageName(), testhelper.NewTestObjectPoolName(t))
+ pool, err := objectpool.NewObjectPool(config.Config, config.NewLocator(config.Config), git.NewExecCommandFactory(config.Config), repo.GetStorageName(), gittest.NewObjectPoolName(t))
require.NoError(t, err)
require.NoError(t, pool.Create(ctx, repo))
@@ -306,7 +306,7 @@ type SSHCloneDetails struct {
// setupSSHClone sets up a test clone
func setupSSHClone(t *testing.T) (SSHCloneDetails, func()) {
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
storagePath := testhelper.GitlabTestStoragePath()
diff --git a/internal/gitaly/service/ssh/upload_archive_test.go b/internal/gitaly/service/ssh/upload_archive_test.go
index e57076524..b6c0e2379 100644
--- a/internal/gitaly/service/ssh/upload_archive_test.go
+++ b/internal/gitaly/service/ssh/upload_archive_test.go
@@ -9,6 +9,7 @@ import (
"github.com/golang/protobuf/jsonpb"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -25,7 +26,7 @@ func TestFailedUploadArchiveRequestDueToTimeout(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
stream, err := client.SSHUploadArchive(ctx)
@@ -107,7 +108,7 @@ func TestUploadArchiveSuccess(t *testing.T) {
cmd := exec.Command(config.Config.Git.BinPath, "archive", "master", "--remote=git@localhost:test/test.git")
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
err := testArchive(t, serverSocketPath, testRepo, cmd)
diff --git a/internal/gitaly/service/ssh/upload_pack_test.go b/internal/gitaly/service/ssh/upload_pack_test.go
index 8fe460b08..c1cb0ada1 100644
--- a/internal/gitaly/service/ssh/upload_pack_test.go
+++ b/internal/gitaly/service/ssh/upload_pack_test.go
@@ -78,7 +78,7 @@ func (cmd cloneCommand) test(t *testing.T, localRepoPath string) (string, string
err := cmd.execute(t)
require.NoError(t, err)
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
storagePath := testhelper.GitlabTestStoragePath()
@@ -106,7 +106,7 @@ func TestFailedUploadPackRequestDueToTimeout(t *testing.T) {
stream, err := client.SSHUploadPack(ctx)
require.NoError(t, err)
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
// The first request is not limited by timeout, but also not under attacker control
@@ -245,7 +245,7 @@ func TestUploadPackCloneSuccess(t *testing.T) {
},
}
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
for _, tc := range tests {
@@ -294,7 +294,7 @@ func TestUploadPackWithPackObjectsHook(t *testing.T) {
localRepoPath, cleanup := testhelper.TempDir(t)
defer cleanup()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
err := cloneCommand{
@@ -323,7 +323,7 @@ func TestUploadPackWithoutSideband(t *testing.T) {
pktline.WriteFlush(negotiation)
pktline.WriteString(negotiation, "done")
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
request := &gitalypb.SSHUploadPackRequest{
@@ -383,7 +383,7 @@ func TestUploadPackCloneWithPartialCloneFilter(t *testing.T) {
},
}
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
for _, tc := range tests {
@@ -427,7 +427,7 @@ func TestUploadPackCloneSuccessWithGitProtocol(t *testing.T) {
},
}
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
for _, tc := range tests {
@@ -460,7 +460,7 @@ func TestUploadPackCloneHideTags(t *testing.T) {
serverSocketPath, stop := runSSHServer(t)
defer stop()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
localRepoPath, cleanup := testhelper.TempDir(t)
@@ -486,7 +486,7 @@ func TestUploadPackCloneFailure(t *testing.T) {
serverSocketPath, stop := runSSHServer(t)
defer stop()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
localRepoPath, cleanup := testhelper.TempDir(t)
diff --git a/internal/gitaly/service/wiki/find_page_test.go b/internal/gitaly/service/wiki/find_page_test.go
index 459a210c5..cee56b111 100644
--- a/internal/gitaly/service/wiki/find_page_test.go
+++ b/internal/gitaly/service/wiki/find_page_test.go
@@ -6,6 +6,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -469,7 +470,7 @@ func TestInvalidWikiFindPageRequestRevision(t *testing.T) {
}
func TestSuccessfulWikiFindPageRequestWithTrailers(t *testing.T) {
- wikiRepo, worktreePath, cleanupFn := testhelper.InitRepoWithWorktree(t)
+ wikiRepo, worktreePath, cleanupFn := gittest.InitRepoWithWorktree(t)
defer cleanupFn()
committerName := "Scróoge McDuck" // Include UTF-8 to ensure encoding is handled
diff --git a/internal/gitalyssh/gitalyssh_test.go b/internal/gitalyssh/gitalyssh_test.go
index 17173bdaa..8585e808a 100644
--- a/internal/gitalyssh/gitalyssh_test.go
+++ b/internal/gitalyssh/gitalyssh_test.go
@@ -7,6 +7,7 @@ import (
"github.com/golang/protobuf/jsonpb"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -15,7 +16,7 @@ import (
)
func TestUploadPackEnv(t *testing.T) {
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
ctx, cancel := testhelper.Context()
diff --git a/internal/middleware/commandstatshandler/commandstatshandler_test.go b/internal/middleware/commandstatshandler/commandstatshandler_test.go
index 732bd8014..1c1c40bf5 100644
--- a/internal/middleware/commandstatshandler/commandstatshandler_test.go
+++ b/internal/middleware/commandstatshandler/commandstatshandler_test.go
@@ -12,6 +12,7 @@ import (
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/service/ref"
"gitlab.com/gitlab-org/gitaly/internal/log"
@@ -73,7 +74,7 @@ func TestInterceptor(t *testing.T) {
require.NoError(t, err)
}()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
tests := []struct {
diff --git a/internal/praefect/coordinator_test.go b/internal/praefect/coordinator_test.go
index 45f173999..e2d29b27f 100644
--- a/internal/praefect/coordinator_test.go
+++ b/internal/praefect/coordinator_test.go
@@ -17,6 +17,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/client"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag"
"gitlab.com/gitlab-org/gitaly/internal/middleware/metadatahandler"
"gitlab.com/gitlab-org/gitaly/internal/praefect/config"
@@ -1404,7 +1405,7 @@ func TestCoordinator_grpcErrorHandling(t *testing.T) {
})
defer cleanup()
- repoProto, _, cleanup := testhelper.NewTestRepo(t)
+ repoProto, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
operationClient := gitalypb.NewOperationServiceClient(praefectConn)
diff --git a/internal/praefect/info_service_test.go b/internal/praefect/info_service_test.go
index bc8a17bff..76dd23e68 100644
--- a/internal/praefect/info_service_test.go
+++ b/internal/praefect/info_service_test.go
@@ -56,9 +56,9 @@ func TestInfoService_RepositoryReplicas(t *testing.T) {
Failover: config.Failover{Enabled: true},
}
- testRepo := testhelper.NewTestRepoTo(t, cfg.Storages[0].Path, "repo-1")
- testhelper.NewTestRepoTo(t, cfg.Storages[1].Path, "repo-1")
- testhelper.NewTestRepoTo(t, cfg.Storages[2].Path, "repo-1")
+ testRepo := gittest.CloneRepoAtStorageRoot(t, cfg.Storages[0].Path, "repo-1")
+ gittest.CloneRepoAtStorageRoot(t, cfg.Storages[1].Path, "repo-1")
+ gittest.CloneRepoAtStorageRoot(t, cfg.Storages[2].Path, "repo-1")
// create a commit in the second replica so we can check that its checksum is different than the primary
gittest.CreateCommit(t, filepath.Join(cfg.Storages[1].Path, "repo-1"), "master", nil)
diff --git a/internal/praefect/middleware/errorhandler_test.go b/internal/praefect/middleware/errorhandler_test.go
index e237db85a..72e969f5c 100644
--- a/internal/praefect/middleware/errorhandler_test.go
+++ b/internal/praefect/middleware/errorhandler_test.go
@@ -10,6 +10,7 @@ import (
"github.com/golang/protobuf/ptypes/empty"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/helper"
"gitlab.com/gitlab-org/gitaly/internal/praefect/grpc-proxy/proxy"
"gitlab.com/gitlab-org/gitaly/internal/praefect/mock"
@@ -97,7 +98,7 @@ func TestStreamInterceptor(t *testing.T) {
simpleClient := mock.NewSimpleServiceClient(praefectCC)
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
for i := 0; i < threshold; i++ {
diff --git a/internal/praefect/replicator_test.go b/internal/praefect/replicator_test.go
index 7c1ca703c..79433a660 100644
--- a/internal/praefect/replicator_test.go
+++ b/internal/praefect/replicator_test.go
@@ -107,7 +107,7 @@ func TestReplMgr_ProcessBacklog(t *testing.T) {
srvSocketPath, clean := runFullGitalyServer(t)
defer clean()
- testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
conf := config.Config{
@@ -131,7 +131,7 @@ func TestReplMgr_ProcessBacklog(t *testing.T) {
}
// create object pool on the source
- objectPoolPath := testhelper.NewTestObjectPoolName(t)
+ objectPoolPath := gittest.NewObjectPoolName(t)
pool, err := objectpool.NewObjectPool(gitaly_config.Config, gitaly_config.NewLocator(gitaly_config.Config), git.NewExecCommandFactory(gitaly_config.Config), testRepo.GetStorageName(), objectPoolPath)
require.NoError(t, err)
@@ -523,10 +523,10 @@ func TestConfirmReplication(t *testing.T) {
srvSocketPath, clean := runFullGitalyServer(t)
defer clean()
- testRepoA, testRepoAPath, cleanupFn := testhelper.NewTestRepo(t)
+ testRepoA, testRepoAPath, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
- testRepoB, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepoB, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
connOpts := []grpc.DialOption{
@@ -599,7 +599,7 @@ func TestProcessBacklog_FailedJobs(t *testing.T) {
primarySvr, primarySocket := newReplicationService(t)
defer primarySvr.Stop()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
primary := config.Node{
@@ -727,7 +727,7 @@ func TestProcessBacklog_Success(t *testing.T) {
primarySvr, primarySocket := newReplicationService(t)
defer primarySvr.Stop()
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
+ testRepo, _, cleanupFn := gittest.CloneRepo(t)
defer cleanupFn()
primary := config.Node{
diff --git a/internal/praefect/server_factory_test.go b/internal/praefect/server_factory_test.go
index 6426bb4b3..9d5783503 100644
--- a/internal/praefect/server_factory_test.go
+++ b/internal/praefect/server_factory_test.go
@@ -14,6 +14,7 @@ import (
"gitlab.com/gitlab-org/gitaly/client"
"gitlab.com/gitlab-org/gitaly/internal/bootstrap/starter"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
gconfig "gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/server"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/service/commit"
@@ -84,7 +85,7 @@ func TestServerFactory(t *testing.T) {
Failover: config.Failover{Enabled: true},
}
- repo, repoPath, cleanup := testhelper.NewTestRepo(t)
+ repo, repoPath, cleanup := gittest.CloneRepo(t)
defer cleanup()
repo.StorageName = conf.VirtualStorages[0].Name // storage must be re-written to virtual to be properly redirected by praefect
revision := text.ChompBytes(testhelper.MustRunCommand(t, nil, "git", "-C", repoPath, "rev-parse", "HEAD"))
diff --git a/internal/praefect/server_test.go b/internal/praefect/server_test.go
index 4c7f17e50..1aa298b35 100644
--- a/internal/praefect/server_test.go
+++ b/internal/praefect/server_test.go
@@ -21,6 +21,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
gconfig "gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/helper"
"gitlab.com/gitlab-org/gitaly/internal/helper/text"
@@ -701,7 +702,7 @@ func TestProxyWrites(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ testRepo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
rs := datastore.MockRepositoryStore{
@@ -894,7 +895,7 @@ func TestErrorThreshold(t *testing.T) {
require.NoError(t, err)
cli := mock.NewSimpleServiceClient(conn)
- repo, _, cleanup := testhelper.NewTestRepo(t)
+ repo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
node := nodeMgr.Nodes()["default"][0]
diff --git a/internal/praefect/service/info/consistencycheck_test.go b/internal/praefect/service/info/consistencycheck_test.go
index e54ce8a0c..e9266784c 100644
--- a/internal/praefect/service/info/consistencycheck_test.go
+++ b/internal/praefect/service/info/consistencycheck_test.go
@@ -13,6 +13,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/client"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
gconfig "gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/service/internalgitaly"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/service/repository"
@@ -49,8 +50,8 @@ func TestServer_ConsistencyCheck(t *testing.T) {
defer cleanupSec()
// firstRepoPath exists on both storages and has same state
- testhelper.NewTestRepoTo(t, primaryStorageDir, firstRepoPath)
- testhelper.NewTestRepoTo(t, secondaryStorageDir, firstRepoPath)
+ gittest.CloneRepoAtStorageRoot(t, primaryStorageDir, firstRepoPath)
+ gittest.CloneRepoAtStorageRoot(t, secondaryStorageDir, firstRepoPath)
cfg.Storages = []gconfig.Storage{{
Name: referenceStorageName,
@@ -187,9 +188,9 @@ func TestServer_ConsistencyCheck(t *testing.T) {
// secondRepoPath generates an error, but it should not stop other repositories from being processed.
// Order does matter for the test to verify the flow.
- testhelper.NewTestRepoTo(t, secondaryStorageDir, secondRepoPath)
+ gittest.CloneRepoAtStorageRoot(t, secondaryStorageDir, secondRepoPath)
// thirdRepoPath exists only on the reference storage (where traversal happens).
- testhelper.NewTestRepoTo(t, secondaryStorageDir, thirdRepoPath)
+ gittest.CloneRepoAtStorageRoot(t, secondaryStorageDir, thirdRepoPath)
// not.git is a folder on the reference storage that should be skipped as it is not a git repository.
require.NoError(t, os.MkdirAll(filepath.Join(secondaryStorageDir, "not.git"), os.ModePerm))
diff --git a/internal/tempdir/tempdir_test.go b/internal/tempdir/tempdir_test.go
index 29f952ef2..b792ae2c1 100644
--- a/internal/tempdir/tempdir_test.go
+++ b/internal/tempdir/tempdir_test.go
@@ -10,6 +10,7 @@ import (
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/test"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -19,7 +20,7 @@ func TestNewAsRepositorySuccess(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- repo, _, cleanup := testhelper.NewTestRepo(t)
+ repo, _, cleanup := gittest.CloneRepo(t)
defer cleanup()
locator := config.NewLocator(config.Config)
diff --git a/internal/testhelper/testcfg/gitaly_builder.go b/internal/testhelper/testcfg/gitaly_builder.go
index ba685ed0b..f14f84a95 100644
--- a/internal/testhelper/testcfg/gitaly_builder.go
+++ b/internal/testhelper/testcfg/gitaly_builder.go
@@ -6,6 +6,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -122,7 +123,7 @@ func (gc *GitalyCfgBuilder) BuildWithRepoAt(t testing.TB, relativePath string) (
// clone the test repo to the each storage
repos := make([]*gitalypb.Repository, len(cfg.Storages))
for i, gitalyStorage := range cfg.Storages {
- repos[i] = testhelper.NewTestRepoTo(t, gitalyStorage.Path, relativePath)
+ repos[i] = gittest.CloneRepoAtStorage(t, gitalyStorage, relativePath)
repos[i].StorageName = gitalyStorage.Name
}