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
path: root/cmd
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-08-25 12:06:00 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-08-30 13:03:20 +0300
commitf34bed055a44181c0ceab0895571972cb80148c2 (patch)
tree9ff959d7deb91ab216d2d4bb8d998dcf37393851 /cmd
parent0b2a982c6502a52bf23c2e2aa8dd037f20361b34 (diff)
gitlab: Generalize GitLab mock client
The GitLab mock client will currently always return success for all of its stubbed functions. In a subsequent patch, we'll want to write tests though which return various failures instead. Prepare for this by generalizing the mock client such that callers can pass arbitrary implementations of its mocked functions.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gitaly-hooks/hooks_test.go4
-rw-r--r--cmd/gitaly-ssh/auth_test.go4
2 files changed, 6 insertions, 2 deletions
diff --git a/cmd/gitaly-hooks/hooks_test.go b/cmd/gitaly-hooks/hooks_test.go
index 1f1c538d1..60154b70b 100644
--- a/cmd/gitaly-hooks/hooks_test.go
+++ b/cmd/gitaly-hooks/hooks_test.go
@@ -580,7 +580,9 @@ func TestCheckBadCreds(t *testing.T) {
}
func runHookServiceServer(t *testing.T, cfg config.Cfg, serverOpts ...testserver.GitalyServerOpt) {
- runHookServiceWithGitlabClient(t, cfg, gitlab.NewMockClient(), serverOpts...)
+ runHookServiceWithGitlabClient(t, cfg, gitlab.NewMockClient(
+ t, gitlab.MockAllowed, gitlab.MockPreReceive, gitlab.MockPostReceive,
+ ), serverOpts...)
}
type featureFlagAsserter struct {
diff --git a/cmd/gitaly-ssh/auth_test.go b/cmd/gitaly-ssh/auth_test.go
index 3f59bdb5c..81209bf3d 100644
--- a/cmd/gitaly-ssh/auth_test.go
+++ b/cmd/gitaly-ssh/auth_test.go
@@ -148,7 +148,9 @@ func runServer(t *testing.T, secure bool, cfg config.Cfg, connectionType string,
locator := config.NewLocator(cfg)
registry := backchannel.NewRegistry()
txManager := transaction.NewManager(cfg, registry)
- hookManager := hook.NewManager(locator, txManager, gitlab.NewMockClient(), cfg)
+ hookManager := hook.NewManager(locator, txManager, gitlab.NewMockClient(
+ t, gitlab.MockAllowed, gitlab.MockPreReceive, gitlab.MockPostReceive,
+ ), cfg)
gitCmdFactory := git.NewExecCommandFactory(cfg)
diskCache := cache.New(cfg, locator)
srv, err := server.New(secure, cfg, testhelper.DiscardTestEntry(t), registry, diskCache)