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:
authorPavlo Strokov <pstrokov@gitlab.com>2021-05-03 22:17:12 +0300
committerPavlo Strokov <pstrokov@gitlab.com>2021-05-11 14:25:16 +0300
commit2b825430d269b31fa2ec540313c35389692171ee (patch)
treea37689387bb1a0600c3ce0dbf2428f6afbb8b066
parent56998811ca29dfb96c6e7cbd8066c4ec682e8f2d (diff)
Replace MustRunCommand with gittest.Exec for fullRepack
To break dependency on the global config.Config variable the git commands should be executed with gittest.Exec. The function requires a config.Cfg to be passed as incoming parameter to use proper git binary for the command execution. Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2699
-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
2 files changed, 4 insertions, 4 deletions
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 6103a0dee..81efcdc19 100644
--- a/internal/gitaly/service/repository/clone_from_pool_internal_test.go
+++ b/internal/gitaly/service/repository/clone_from_pool_internal_test.go
@@ -66,7 +66,7 @@ func TestCloneFromPoolInternal(t *testing.T) {
require.NoError(t, pool.Create(ctx, repo))
require.NoError(t, pool.Link(ctx, repo))
- fullRepack(t, repoPath)
+ fullRepack(t, cfg, repoPath)
gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch("branch"))
@@ -97,6 +97,6 @@ func TestCloneFromPoolInternal(t *testing.T) {
}
// fullRepack does a full repack on the repository, which means if it has a pool repository linked, it will get rid of redundant objects that are reachable in the pool
-func fullRepack(t *testing.T, repoPath string) {
- testhelper.MustRunCommand(t, nil, "git", "-C", repoPath, "repack", "-A", "-l", "-d")
+func fullRepack(t *testing.T, cfg config.Cfg, repoPath string) {
+ gittest.Exec(t, cfg, "-C", repoPath, "repack", "-A", "-l", "-d")
}
diff --git a/internal/gitaly/service/repository/clone_from_pool_test.go b/internal/gitaly/service/repository/clone_from_pool_test.go
index e47b26ad7..fe6bbd87e 100644
--- a/internal/gitaly/service/repository/clone_from_pool_test.go
+++ b/internal/gitaly/service/repository/clone_from_pool_test.go
@@ -30,7 +30,7 @@ func testCloneFromPoolHTTP(t *testing.T, cfg config.Cfg, rubySrv *rubyserver.Ser
require.NoError(t, pool.Create(ctx, repo))
require.NoError(t, pool.Link(ctx, repo))
- fullRepack(t, repoPath)
+ fullRepack(t, cfg, repoPath)
gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch("branch"))