diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-01-11 17:27:24 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-01-11 17:52:27 +0300 |
commit | 2c2551685ff85c024ccd2c8d7f9db8ab9dc52481 (patch) | |
tree | 90de01b48061100e6e44f0317678200dae05b79b /cmd/gitaly-ssh | |
parent | 3d9f3fb02256ce3ac803b1e5f809cea62e6544f7 (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 'cmd/gitaly-ssh')
-rw-r--r-- | cmd/gitaly-ssh/auth_test.go | 3 | ||||
-rw-r--r-- | cmd/gitaly-ssh/upload_pack_test.go | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/cmd/gitaly-ssh/auth_test.go b/cmd/gitaly-ssh/auth_test.go index 8a17d7130..b0e84456a 100644 --- a/cmd/gitaly-ssh/auth_test.go +++ b/cmd/gitaly-ssh/auth_test.go @@ -13,7 +13,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/client" "gitlab.com/gitlab-org/gitaly/v14/internal/backchannel" "gitlab.com/gitlab-org/gitaly/v14/internal/cache" - "gitlab.com/gitlab-org/gitaly/v14/internal/git" "gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest" "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/config" "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/hook" @@ -148,7 +147,7 @@ func runServer(t *testing.T, secure bool, cfg config.Cfg, connectionType string, locator := config.NewLocator(cfg) registry := backchannel.NewRegistry() txManager := transaction.NewManager(cfg, registry) - gitCmdFactory := git.NewExecCommandFactory(cfg) + gitCmdFactory := gittest.NewCommandFactory(t, cfg) hookManager := hook.NewManager(cfg, locator, gitCmdFactory, txManager, gitlab.NewMockClient( t, gitlab.MockAllowed, gitlab.MockPreReceive, gitlab.MockPostReceive, )) diff --git a/cmd/gitaly-ssh/upload_pack_test.go b/cmd/gitaly-ssh/upload_pack_test.go index 504f5c2e9..9d2ae412e 100644 --- a/cmd/gitaly-ssh/upload_pack_test.go +++ b/cmd/gitaly-ssh/upload_pack_test.go @@ -40,7 +40,7 @@ func TestVisibilityOfHiddenRefs(t *testing.T) { existingSha := "1e292f8fedd741b75372e19097c76d327140c312" keepAroundRef := fmt.Sprintf("%s/%s", keepAroundNamespace, existingSha) - gitCmdFactory := git.NewExecCommandFactory(cfg) + gitCmdFactory := gittest.NewCommandFactory(t, cfg) localRepo := localrepo.NewTestRepo(t, cfg, repo) updater, err := updateref.New(ctx, cfg, localRepo) |