summaryrefslogtreecommitdiff
path: root/internal/handler/exec_test.go
diff options
context:
space:
mode:
authorPatrick Bajao <ebajao@gitlab.com>2022-05-04 04:55:58 +0000
committerPatrick Bajao <ebajao@gitlab.com>2022-05-04 04:55:58 +0000
commitd43b496296d97cdab5f7caa0895a3f9cda027410 (patch)
treeff0878b5a1117a2cd05608237d5c852b6adfb126 /internal/handler/exec_test.go
parent4828228c95cf9789614a04df06d3d55dda63b2ca (diff)
parentb2b31cee4a27cccd100a5f0aa546d5a515576ada (diff)
downloadgitlab-shell-d43b496296d97cdab5f7caa0895a3f9cda027410.tar.gz
Merge branch 'jv-always-use-sidechannel' into 'main'
Always use Gitaly sidechannel connections See merge request gitlab-org/gitlab-shell!567
Diffstat (limited to 'internal/handler/exec_test.go')
-rw-r--r--internal/handler/exec_test.go22
1 files changed, 13 insertions, 9 deletions
diff --git a/internal/handler/exec_test.go b/internal/handler/exec_test.go
index 8f1d5b2..791fe79 100644
--- a/internal/handler/exec_test.go
+++ b/internal/handler/exec_test.go
@@ -29,7 +29,7 @@ func makeHandler(t *testing.T, err error) func(context.Context, *grpc.ClientConn
func TestRunGitalyCommand(t *testing.T) {
cmd := NewGitalyCommand(
- &config.Config{},
+ newConfig(),
string(commandargs.UploadPack),
&accessverifier.Response{
Gitaly: accessverifier.Gitaly{Address: "tcp://localhost:9999"},
@@ -46,14 +46,12 @@ func TestRunGitalyCommand(t *testing.T) {
func TestCachingOfGitalyConnections(t *testing.T) {
ctx := context.Background()
- cfg := &config.Config{}
- cfg.GitalyClient.InitSidechannelRegistry(ctx)
+ cfg := newConfig()
response := &accessverifier.Response{
Username: "user",
Gitaly: accessverifier.Gitaly{
- Address: "tcp://localhost:9999",
- Token: "token",
- UseSidechannel: true,
+ Address: "tcp://localhost:9999",
+ Token: "token",
},
}
@@ -71,7 +69,7 @@ func TestCachingOfGitalyConnections(t *testing.T) {
}
func TestMissingGitalyAddress(t *testing.T) {
- cmd := GitalyCommand{Config: &config.Config{}}
+ cmd := GitalyCommand{Config: newConfig()}
err := cmd.RunGitalyCommand(context.Background(), makeHandler(t, nil))
require.EqualError(t, err, "no gitaly_address given")
@@ -79,7 +77,7 @@ func TestMissingGitalyAddress(t *testing.T) {
func TestUnavailableGitalyErr(t *testing.T) {
cmd := NewGitalyCommand(
- &config.Config{},
+ newConfig(),
string(commandargs.UploadPack),
&accessverifier.Response{
Gitaly: accessverifier.Gitaly{Address: "tcp://localhost:9999"},
@@ -101,7 +99,7 @@ func TestRunGitalyCommandMetadata(t *testing.T) {
{
name: "gitaly_feature_flags",
gc: NewGitalyCommand(
- &config.Config{},
+ newConfig(),
string(commandargs.UploadPack),
&accessverifier.Response{
Gitaly: accessverifier.Gitaly{
@@ -209,3 +207,9 @@ func TestPrepareContext(t *testing.T) {
})
}
}
+
+func newConfig() *config.Config {
+ cfg := &config.Config{}
+ cfg.GitalyClient.InitSidechannelRegistry(context.Background())
+ return cfg
+}