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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-02-01 12:16:13 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-02-01 12:22:21 +0300
commita1d4dd385dd59d1b9bd4922a9935dbf344467b94 (patch)
treef1f59fcdbb676e011e4dd33810100da2bf726381
parentd56fd8e9ba34ec7d54f7390e4ceab9adb43e49d9 (diff)
gittest: Rename helper which detects the GIT_PROTOCOL
The gittest package exposes a helper `EnableGitProtocolV2Support()`. Despite its naming, this function doesn't enable any Git protocol at all. Instead, it creates an intercepting Git command factory which allows us to detect the Git protocol that's when running the remote side of a fetch or push. Rename the function to `NewProtocolDetectingCommandFactory()` to more clearly indicate what it's doing.
-rw-r--r--internal/git/gittest/protocol.go4
-rw-r--r--internal/gitaly/service/smarthttp/inforefs_test.go2
-rw-r--r--internal/gitaly/service/smarthttp/receive_pack_test.go2
-rw-r--r--internal/gitaly/service/smarthttp/upload_pack_test.go2
-rw-r--r--internal/gitaly/service/ssh/receive_pack_test.go4
-rw-r--r--internal/gitaly/service/ssh/upload_pack_test.go2
6 files changed, 8 insertions, 8 deletions
diff --git a/internal/git/gittest/protocol.go b/internal/git/gittest/protocol.go
index 5ba3df11e..301cf34e5 100644
--- a/internal/git/gittest/protocol.go
+++ b/internal/git/gittest/protocol.go
@@ -13,10 +13,10 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
)
-// EnableGitProtocolV2Support creates a new intercepting Git command factory that allows the
+// NewProtocolDetectingCommandFactory creates a new intercepting Git command factory that allows the
// protocol to be tested. It returns this factory and a function to read the GIT_PROTOCOL
// environment variable created by the wrapper script.
-func EnableGitProtocolV2Support(ctx context.Context, t testing.TB, cfg config.Cfg) (git.CommandFactory, func() string) {
+func NewProtocolDetectingCommandFactory(ctx context.Context, t testing.TB, cfg config.Cfg) (git.CommandFactory, func() string) {
envPath := filepath.Join(testhelper.TempDir(t), "git-env")
gitCmdFactory := NewInterceptingCommandFactory(ctx, t, cfg, func(execEnv git.ExecutionEnvironment) string {
diff --git a/internal/gitaly/service/smarthttp/inforefs_test.go b/internal/gitaly/service/smarthttp/inforefs_test.go
index 116c28914..bf32b6460 100644
--- a/internal/gitaly/service/smarthttp/inforefs_test.go
+++ b/internal/gitaly/service/smarthttp/inforefs_test.go
@@ -115,7 +115,7 @@ func TestSuccessfulInfoRefsUploadPackWithGitProtocol(t *testing.T) {
cfg, repo, _ := testcfg.BuildWithRepo(t)
ctx := testhelper.Context(t)
- gitCmdFactory, readProtocol := gittest.EnableGitProtocolV2Support(ctx, t, cfg)
+ gitCmdFactory, readProtocol := gittest.NewProtocolDetectingCommandFactory(ctx, t, cfg)
server := startSmartHTTPServerWithOptions(t, cfg, nil, []testserver.GitalyServerOpt{
testserver.WithGitCommandFactory(gitCmdFactory),
diff --git a/internal/gitaly/service/smarthttp/receive_pack_test.go b/internal/gitaly/service/smarthttp/receive_pack_test.go
index 773600cc0..742058bce 100644
--- a/internal/gitaly/service/smarthttp/receive_pack_test.go
+++ b/internal/gitaly/service/smarthttp/receive_pack_test.go
@@ -167,7 +167,7 @@ func TestSuccessfulReceivePackRequestWithGitProtocol(t *testing.T) {
testcfg.BuildGitalyHooks(t, cfg)
ctx := testhelper.Context(t)
- gitCmdFactory, readProto := gittest.EnableGitProtocolV2Support(ctx, t, cfg)
+ gitCmdFactory, readProto := gittest.NewProtocolDetectingCommandFactory(ctx, t, cfg)
server := startSmartHTTPServerWithOptions(t, cfg, nil, []testserver.GitalyServerOpt{
testserver.WithGitCommandFactory(gitCmdFactory),
diff --git a/internal/gitaly/service/smarthttp/upload_pack_test.go b/internal/gitaly/service/smarthttp/upload_pack_test.go
index c0fda063b..d7923f571 100644
--- a/internal/gitaly/service/smarthttp/upload_pack_test.go
+++ b/internal/gitaly/service/smarthttp/upload_pack_test.go
@@ -175,7 +175,7 @@ func TestServer_PostUploadPackWithSidechannel_gitProtocol(t *testing.T) {
func testServerPostUploadPackGitProtocol(t *testing.T, ctx context.Context, makeRequest requestMaker, opts ...testcfg.Option) {
cfg, repo, _ := testcfg.BuildWithRepo(t, opts...)
- gitCmdFactory, readProto := gittest.EnableGitProtocolV2Support(ctx, t, cfg)
+ gitCmdFactory, readProto := gittest.NewProtocolDetectingCommandFactory(ctx, t, cfg)
server := startSmartHTTPServerWithOptions(t, cfg, nil, []testserver.GitalyServerOpt{
testserver.WithGitCommandFactory(gitCmdFactory),
})
diff --git a/internal/gitaly/service/ssh/receive_pack_test.go b/internal/gitaly/service/ssh/receive_pack_test.go
index 6c06a86c5..a6ecd2375 100644
--- a/internal/gitaly/service/ssh/receive_pack_test.go
+++ b/internal/gitaly/service/ssh/receive_pack_test.go
@@ -168,7 +168,7 @@ func TestReceivePackPushSuccessWithGitProtocol(t *testing.T) {
testcfg.BuildGitalyHooks(t, cfg)
ctx := testhelper.Context(t)
- gitCmdFactory, readProto := gittest.EnableGitProtocolV2Support(ctx, t, cfg)
+ gitCmdFactory, readProto := gittest.NewProtocolDetectingCommandFactory(ctx, t, cfg)
serverSocketPath := runSSHServer(t, cfg, testserver.WithGitCommandFactory(gitCmdFactory))
@@ -491,7 +491,7 @@ func TestSSHReceivePackToHooks(t *testing.T) {
)
ctx := testhelper.Context(t)
- gitCmdFactory, readProto := gittest.EnableGitProtocolV2Support(ctx, t, cfg)
+ gitCmdFactory, readProto := gittest.NewProtocolDetectingCommandFactory(ctx, t, cfg)
tempGitlabShellDir := testhelper.TempDir(t)
diff --git a/internal/gitaly/service/ssh/upload_pack_test.go b/internal/gitaly/service/ssh/upload_pack_test.go
index d96df2fb8..9f89e84fe 100644
--- a/internal/gitaly/service/ssh/upload_pack_test.go
+++ b/internal/gitaly/service/ssh/upload_pack_test.go
@@ -466,7 +466,7 @@ func testUploadPackCloneSuccessWithGitProtocol(t *testing.T, opts ...testcfg.Opt
cfg, repo, repoPath := testcfg.BuildWithRepo(t, opts...)
ctx := testhelper.Context(t)
- gitCmdFactory, readProto := gittest.EnableGitProtocolV2Support(ctx, t, cfg)
+ gitCmdFactory, readProto := gittest.NewProtocolDetectingCommandFactory(ctx, t, cfg)
serverSocketPath := runSSHServer(t, cfg, testserver.WithGitCommandFactory(gitCmdFactory))