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>2022-01-11 17:27:24 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-01-11 17:52:27 +0300
commit2c2551685ff85c024ccd2c8d7f9db8ab9dc52481 (patch)
tree90de01b48061100e6e44f0317678200dae05b79b /internal/gitaly/hook/prereceive_test.go
parent3d9f3fb02256ce3ac803b1e5f809cea62e6544f7 (diff)
gittest: Provide helper function to create command factories
We're about to change the ExecCommandFactory to carry state soonish, which both requires us to return an error code and a cleanup function. This is going to become tedious to manage in our tests given that there's many locations where we construct the factory. Introduce a new function `gittest.NewCommandFactory()` to be used in tests, such that callsites don't have to handle all of this.
Diffstat (limited to 'internal/gitaly/hook/prereceive_test.go')
-rw-r--r--internal/gitaly/hook/prereceive_test.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/gitaly/hook/prereceive_test.go b/internal/gitaly/hook/prereceive_test.go
index ddce1ec9f..14d39c9e8 100644
--- a/internal/gitaly/hook/prereceive_test.go
+++ b/internal/gitaly/hook/prereceive_test.go
@@ -27,7 +27,7 @@ import (
func TestPrereceive_customHooks(t *testing.T) {
cfg, repo, repoPath := testcfg.BuildWithRepo(t)
- gitCmdFactory := git.NewExecCommandFactory(cfg)
+ gitCmdFactory := gittest.NewCommandFactory(t, cfg)
locator := config.NewLocator(cfg)
hookManager := NewManager(cfg, locator, gitCmdFactory, transaction.NewManager(cfg, backchannel.NewRegistry()), gitlab.NewMockClient(
@@ -187,7 +187,7 @@ func TestPrereceive_quarantine(t *testing.T) {
blobID, err := quarantinedRepo.WriteBlob(ctx, "", strings.NewReader("allyourbasearebelongtous"))
require.NoError(t, err)
- hookManager := NewManager(cfg, config.NewLocator(cfg), git.NewExecCommandFactory(cfg), nil, gitlab.NewMockClient(
+ hookManager := NewManager(cfg, config.NewLocator(cfg), gittest.NewCommandFactory(t, cfg), nil, gitlab.NewMockClient(
t, gitlab.MockAllowed, gitlab.MockPreReceive, gitlab.MockPostReceive,
))
@@ -364,7 +364,7 @@ func TestPrereceive_gitlab(t *testing.T) {
},
}
- hookManager := NewManager(cfg, config.NewLocator(cfg), git.NewExecCommandFactory(cfg), transaction.NewManager(cfg, backchannel.NewRegistry()), &gitlabAPI)
+ hookManager := NewManager(cfg, config.NewLocator(cfg), gittest.NewCommandFactory(t, cfg), transaction.NewManager(cfg, backchannel.NewRegistry()), &gitlabAPI)
gittest.WriteCustomHook(t, repoPath, "pre-receive", []byte("#!/bin/sh\necho called\n"))