From 447b5185c005ffded1ea515f6fd43544a59c9c2e Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Mon, 26 Apr 2021 10:50:56 +0200 Subject: gitlab: Merge client and API implementations The HTTPClient and the internal API implementation are currently split up across two different times, even though the latter defers everything to the HTTPClient. This separation of concerns is at times a bit weird, and doesn't really help to understand the code. Merge these two types into HTTPClient to lift this artificial restriction. --- cmd/gitaly-hooks/hooks.go | 2 +- cmd/gitaly-hooks/hooks_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'cmd/gitaly-hooks') diff --git a/cmd/gitaly-hooks/hooks.go b/cmd/gitaly-hooks/hooks.go index 4f4814b69..822a8947b 100644 --- a/cmd/gitaly-hooks/hooks.go +++ b/cmd/gitaly-hooks/hooks.go @@ -182,7 +182,7 @@ func check(configPath string) (*gitlab.CheckInfo, error) { return nil, err } - gitlabAPI, err := gitlab.NewGitlabAPI(cfg.Gitlab, cfg.TLS) + gitlabAPI, err := gitlab.NewHTTPClient(cfg.Gitlab, cfg.TLS) if err != nil { return nil, err } diff --git a/cmd/gitaly-hooks/hooks_test.go b/cmd/gitaly-hooks/hooks_test.go index ba04d7f20..3ca038d36 100644 --- a/cmd/gitaly-hooks/hooks_test.go +++ b/cmd/gitaly-hooks/hooks_test.go @@ -172,7 +172,7 @@ func testHooksPrePostReceive(t *testing.T, cfg config.Cfg, repo *gitalypb.Reposi t.Run(fmt.Sprintf("hookName: %s", hookName), func(t *testing.T) { customHookOutputPath := gittest.WriteEnvToCustomHook(t, repoPath, hookName) - gitlabAPI, err := gitlab.NewGitlabAPI(cfg.Gitlab, cfg.TLS) + gitlabAPI, err := gitlab.NewHTTPClient(cfg.Gitlab, cfg.TLS) require.NoError(t, err) stop := runHookServiceServerWithAPI(t, cfg, gitlabAPI) @@ -351,7 +351,7 @@ func TestHooksPostReceiveFailed(t *testing.T) { cfg.Gitlab.URL = serverURL cfg.Gitlab.SecretFile = testhelper.WriteShellSecretFile(t, cfg.GitlabShell.Dir, secretToken) - gitlabAPI, err := gitlab.NewGitlabAPI(cfg.Gitlab, cfg.TLS) + gitlabAPI, err := gitlab.NewHTTPClient(cfg.Gitlab, cfg.TLS) require.NoError(t, err) customHookOutputPath := gittest.WriteEnvToCustomHook(t, repoPath, "post-receive") @@ -465,7 +465,7 @@ func TestHooksNotAllowed(t *testing.T) { customHookOutputPath := gittest.WriteEnvToCustomHook(t, repoPath, "post-receive") - gitlabAPI, err := gitlab.NewGitlabAPI(cfg.Gitlab, cfg.TLS) + gitlabAPI, err := gitlab.NewHTTPClient(cfg.Gitlab, cfg.TLS) require.NoError(t, err) stop := runHookServiceServerWithAPI(t, cfg, gitlabAPI) -- cgit v1.2.3