diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-01-29 17:02:43 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-01-29 17:02:43 +0300 |
commit | 8d24bf509b9c9deba8725fb27fc93251c486c290 (patch) | |
tree | c3599c2ff961ec899347c66ae59154662e82d2c0 /internal/gitaly/service/repository/fetch_test.go | |
parent | 4b74f048231c8d3614343f9b760513e5d2fb3252 (diff) |
hook: Dependency-inject transaction manager
The transaction.Manager is currently instantiated by the hook.Manager
directly, which was done in order to make splitting up transaction and
hook logic focussed on the task without doing global changes in the
preceding commit. We do want to dependency inject it from external
though given that hooks aren't going to be the single location where
they're used.
So let's do so and adjust all sites where the hook manager is
instantiated to also pass a transaction manager.
Diffstat (limited to 'internal/gitaly/service/repository/fetch_test.go')
-rw-r--r-- | internal/gitaly/service/repository/fetch_test.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/internal/gitaly/service/repository/fetch_test.go b/internal/gitaly/service/repository/fetch_test.go index f2e6a5f9e..e8f69cd52 100644 --- a/internal/gitaly/service/repository/fetch_test.go +++ b/internal/gitaly/service/repository/fetch_test.go @@ -14,6 +14,7 @@ import ( serverPkg "gitlab.com/gitlab-org/gitaly/internal/gitaly/server" hookservice "gitlab.com/gitlab-org/gitaly/internal/gitaly/service/hook" "gitlab.com/gitlab-org/gitaly/internal/gitaly/service/repository" + "gitlab.com/gitlab-org/gitaly/internal/gitaly/transaction" "gitlab.com/gitlab-org/gitaly/internal/storage" "gitlab.com/gitlab-org/gitaly/internal/testhelper" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" @@ -331,7 +332,8 @@ func newTestRepo(t *testing.T, locator storage.Locator, relativePath string) (*g func runFullServer(t *testing.T, locator storage.Locator) (string, func()) { conns := client.NewPool() - hookManager := hook.NewManager(locator, hook.GitlabAPIStub, config.Config) + txManager := transaction.NewManager(config.Config) + hookManager := hook.NewManager(locator, txManager, hook.GitlabAPIStub, config.Config) server := serverPkg.NewInsecure(repository.RubyServer, hookManager, config.Config, conns) @@ -355,7 +357,8 @@ func runFullServer(t *testing.T, locator storage.Locator) (string, func()) { func runFullSecureServer(t *testing.T, locator storage.Locator) (*grpc.Server, string, testhelper.Cleanup) { conns := client.NewPool() - hookManager := hook.NewManager(locator, hook.GitlabAPIStub, config.Config) + txManager := transaction.NewManager(config.Config) + hookManager := hook.NewManager(locator, txManager, hook.GitlabAPIStub, config.Config) server := serverPkg.NewSecure(repository.RubyServer, hookManager, config.Config, conns) listener, addr := testhelper.GetLocalhostListener(t) |