From d005af25ab3224efa0d23be53858710f77e672c6 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 21 Jan 2022 11:05:19 +0000 Subject: Optionally use SSHUploadPackWithSidechannel 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. --- internal/handler/exec_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'internal/handler/exec_test.go') 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()) -- cgit v1.2.1