summaryrefslogtreecommitdiff
path: root/internal/handler/exec_test.go
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2022-01-21 11:05:19 +0000
committerJacob Vosmaer <jacob@gitlab.com>2022-01-21 11:05:19 +0000
commitd005af25ab3224efa0d23be53858710f77e672c6 (patch)
tree0e5363ea426f2d66a646f63f3099ff8361c63e38 /internal/handler/exec_test.go
parentbc25e92dd824591688cbe88cbbeb891b6459b9a9 (diff)
downloadgitlab-shell-jv-ssh-sidechannel.tar.gz
Optionally use SSHUploadPackWithSidechanneljv-ssh-sidechannel
If the GitLab API returns an allowed response with use_sidechannel set to true, gitlab-shell will establish a sidechannel connection and use SSHUploadPackWithSidechannel instead of SSHUploadPack. This is an efficiency improvement.
Diffstat (limited to 'internal/handler/exec_test.go')
-rw-r--r--internal/handler/exec_test.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/handler/exec_test.go b/internal/handler/exec_test.go
index ba6bd6a..784cf19 100644
--- a/internal/handler/exec_test.go
+++ b/internal/handler/exec_test.go
@@ -11,14 +11,15 @@ import (
"google.golang.org/grpc/metadata"
grpcstatus "google.golang.org/grpc/status"
+ "gitlab.com/gitlab-org/gitaly/v14/client"
pb "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"gitlab.com/gitlab-org/gitlab-shell/internal/config"
"gitlab.com/gitlab-org/gitlab-shell/internal/gitlabnet/accessverifier"
"gitlab.com/gitlab-org/gitlab-shell/internal/sshenv"
)
-func makeHandler(t *testing.T, err error) func(context.Context, *grpc.ClientConn) (int32, error) {
- return func(ctx context.Context, client *grpc.ClientConn) (int32, error) {
+func makeHandler(t *testing.T, err error) func(context.Context, *grpc.ClientConn, *client.SidechannelRegistry) (int32, error) {
+ return func(ctx context.Context, client *grpc.ClientConn, registry *client.SidechannelRegistry) (int32, error) {
require.NotNil(t, ctx)
require.NotNil(t, client)
@@ -86,7 +87,7 @@ func TestRunGitalyCommandMetadata(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
cmd := tt.gc
- err := cmd.RunGitalyCommand(context.Background(), func(ctx context.Context, _ *grpc.ClientConn) (int32, error) {
+ err := cmd.RunGitalyCommand(context.Background(), func(ctx context.Context, _ *grpc.ClientConn, _ *client.SidechannelRegistry) (int32, error) {
md, exists := metadata.FromOutgoingContext(ctx)
require.True(t, exists)
require.Equal(t, len(tt.want), md.Len())