diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-01-06 10:59:51 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-01-06 12:11:13 +0300 |
commit | 999a8f5988e7e21a70ad326644560833b49c42b1 (patch) | |
tree | b069f8988e4d16729267697100d1d267ee2c12ff /internal/gitaly/hook/prereceive_test.go | |
parent | d8c65e08e6dd521d2bf73d5f597f84b7e166cbc9 (diff) |
hook: Convert tests to use intercepting command factory
Convert hook tests to use an intercepting Git command factory
instead of modifying the Gitaly configuration.
Diffstat (limited to 'internal/gitaly/hook/prereceive_test.go')
-rw-r--r-- | internal/gitaly/hook/prereceive_test.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/gitaly/hook/prereceive_test.go b/internal/gitaly/hook/prereceive_test.go index a55724f54..ddce1ec9f 100644 --- a/internal/gitaly/hook/prereceive_test.go +++ b/internal/gitaly/hook/prereceive_test.go @@ -27,8 +27,10 @@ import ( func TestPrereceive_customHooks(t *testing.T) { cfg, repo, repoPath := testcfg.BuildWithRepo(t) + gitCmdFactory := git.NewExecCommandFactory(cfg) + locator := config.NewLocator(cfg) - hookManager := NewManager(cfg, config.NewLocator(cfg), git.NewExecCommandFactory(cfg), transaction.NewManager(cfg, backchannel.NewRegistry()), gitlab.NewMockClient( + hookManager := NewManager(cfg, locator, gitCmdFactory, transaction.NewManager(cfg, backchannel.NewRegistry()), gitlab.NewMockClient( t, gitlab.MockAllowed, gitlab.MockPreReceive, gitlab.MockPostReceive, )) @@ -83,7 +85,7 @@ func TestPrereceive_customHooks(t *testing.T) { env: []string{payload}, hook: "#!/bin/sh\nenv | grep -v -e '^SHLVL=' -e '^_=' | sort\n", stdin: "change\n", - expectedStdout: strings.Join(getExpectedEnv(t, cfg, repo), "\n") + "\n", + expectedStdout: strings.Join(getExpectedEnv(ctx, t, locator, gitCmdFactory, repo), "\n") + "\n", }, { desc: "hook receives push options", |