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:
authorKarthik Nayak <knayak@gitlab.com>2023-12-11 21:47:01 +0300
committerKarthik Nayak <knayak@gitlab.com>2023-12-19 11:53:32 +0300
commitecdd4ab0afaef7ec7f06872a32bd43c5d63c6348 (patch)
treeda52b2a8684e560587b3d1fd0e3af27b431fc7e8 /internal/testhelper/testserver/gitaly.go
parentf10129dde26656252c6c590102034aace4b14cae (diff)
hook: Add the `ProcReceiveHook` server
With the creation of `ProcReceiveHook` under the `HookManager`, we can now create the `ProcReceiveHook` server. The server simply propagates the data to/from the `HookMananger.ProcReceiveHook` to the client.
Diffstat (limited to 'internal/testhelper/testserver/gitaly.go')
-rw-r--r--internal/testhelper/testserver/gitaly.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/internal/testhelper/testserver/gitaly.go b/internal/testhelper/testserver/gitaly.go
index d7210b6b8..56089bb4b 100644
--- a/internal/testhelper/testserver/gitaly.go
+++ b/internal/testhelper/testserver/gitaly.go
@@ -286,6 +286,7 @@ type gitalyServerDeps struct {
backupLocator backup.Locator
signingKey string
transactionRegistry *storagemgr.TransactionRegistry
+ procReceiveRegistry *hook.ProcReceiveRegistry
}
func (gsd *gitalyServerDeps) createDependencies(tb testing.TB, cfg config.Cfg) *service.Dependencies {
@@ -323,6 +324,10 @@ func (gsd *gitalyServerDeps) createDependencies(tb testing.TB, cfg config.Cfg) *
gsd.transactionRegistry = storagemgr.NewTransactionRegistry()
}
+ if gsd.procReceiveRegistry == nil {
+ gsd.procReceiveRegistry = hook.NewProcReceiveRegistry()
+ }
+
if gsd.hookMgr == nil {
gsd.hookMgr = hook.NewManager(
cfg, gsd.locator,
@@ -331,7 +336,7 @@ func (gsd *gitalyServerDeps) createDependencies(tb testing.TB, cfg config.Cfg) *
gsd.txMgr,
gsd.gitlabClient,
hook.NewTransactionRegistry(gsd.transactionRegistry),
- hook.NewProcReceiveRegistry(),
+ gsd.procReceiveRegistry,
)
}
@@ -418,6 +423,7 @@ func (gsd *gitalyServerDeps) createDependencies(tb testing.TB, cfg config.Cfg) *
PartitionManager: partitionManager,
BackupSink: gsd.backupSink,
BackupLocator: gsd.backupLocator,
+ ProcReceiveRegistry: gsd.procReceiveRegistry,
}
}
@@ -555,3 +561,11 @@ func WithTransactionRegistry(registry *storagemgr.TransactionRegistry) GitalySer
return deps
}
}
+
+// WithProcReceiveRegistry sets the proc receive registry that will be used for Gitaly services.
+func WithProcReceiveRegistry(registry *hook.ProcReceiveRegistry) GitalyServerOpt {
+ return func(deps gitalyServerDeps) gitalyServerDeps {
+ deps.procReceiveRegistry = registry
+ return deps
+ }
+}