summaryrefslogtreecommitdiff
path: root/internal/testhelper/requesthandlers/requesthandlers.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/testhelper/requesthandlers/requesthandlers.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/testhelper/requesthandlers/requesthandlers.go')
-rw-r--r--internal/testhelper/requesthandlers/requesthandlers.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/testhelper/requesthandlers/requesthandlers.go b/internal/testhelper/requesthandlers/requesthandlers.go
index 6d501d0..2fdaef6 100644
--- a/internal/testhelper/requesthandlers/requesthandlers.go
+++ b/internal/testhelper/requesthandlers/requesthandlers.go
@@ -29,6 +29,14 @@ func BuildDisallowedByApiHandlers(t *testing.T) []testserver.TestRequestHandler
}
func BuildAllowedWithGitalyHandlers(t *testing.T, gitalyAddress string) []testserver.TestRequestHandler {
+ return buildAllowedWithGitalyHandlers(t, gitalyAddress, false)
+}
+
+func BuildAllowedWithGitalyHandlersWithSidechannel(t *testing.T, gitalyAddress string) []testserver.TestRequestHandler {
+ return buildAllowedWithGitalyHandlers(t, gitalyAddress, true)
+}
+
+func buildAllowedWithGitalyHandlers(t *testing.T, gitalyAddress string, useSidechannel bool) []testserver.TestRequestHandler {
requests := []testserver.TestRequestHandler{
{
Path: "/api/v4/internal/allowed",
@@ -56,6 +64,9 @@ func BuildAllowedWithGitalyHandlers(t *testing.T, gitalyAddress string) []testse
},
},
}
+ if useSidechannel {
+ body["gitaly"].(map[string]interface{})["use_sidechannel"] = true
+ }
require.NoError(t, json.NewEncoder(w).Encode(body))
},
},