diff options
| author | Jacob Vosmaer <jacob@gitlab.com> | 2022-05-02 09:34:52 +0000 |
|---|---|---|
| committer | Jacob Vosmaer <jacob@gitlab.com> | 2022-05-02 09:35:12 +0000 |
| commit | b2b31cee4a27cccd100a5f0aa546d5a515576ada (patch) | |
| tree | ff0878b5a1117a2cd05608237d5c852b6adfb126 /internal/gitlabnet | |
| parent | 4828228c95cf9789614a04df06d3d55dda63b2ca (diff) | |
| download | gitlab-shell-b2b31cee4a27cccd100a5f0aa546d5a515576ada.tar.gz | |
Always use Gitaly sidechannel connections
Before this change, the GitLab internal API could use a boolean
response field to indicate whether gitlab-shell should make
sidechannel connections go Gitaly. We now ignore that response field
and always use sidechannel connections.
Diffstat (limited to 'internal/gitlabnet')
| -rw-r--r-- | internal/gitlabnet/accessverifier/client.go | 9 | ||||
| -rw-r--r-- | internal/gitlabnet/accessverifier/client_test.go | 35 |
2 files changed, 4 insertions, 40 deletions
diff --git a/internal/gitlabnet/accessverifier/client.go b/internal/gitlabnet/accessverifier/client.go index c0d10e3..bce32cf 100644 --- a/internal/gitlabnet/accessverifier/client.go +++ b/internal/gitlabnet/accessverifier/client.go @@ -32,11 +32,10 @@ type Request struct { } type Gitaly struct { - Repo pb.Repository `json:"repository"` - Address string `json:"address"` - Token string `json:"token"` - Features map[string]string `json:"features"` - UseSidechannel bool `json:"use_sidechannel"` + Repo pb.Repository `json:"repository"` + Address string `json:"address"` + Token string `json:"token"` + Features map[string]string `json:"features"` } type CustomPayloadData struct { diff --git a/internal/gitlabnet/accessverifier/client_test.go b/internal/gitlabnet/accessverifier/client_test.go index 60e3f0e..13e2d2c 100644 --- a/internal/gitlabnet/accessverifier/client_test.go +++ b/internal/gitlabnet/accessverifier/client_test.go @@ -86,41 +86,6 @@ func TestSuccessfulResponses(t *testing.T) { } } -func TestSidechannelFlag(t *testing.T) { - okResponse := testResponse{body: responseBody(t, "allowed_sidechannel.json"), status: http.StatusOK} - client := setup(t, - map[string]testResponse{"first": okResponse}, - map[string]testResponse{"1": okResponse}, - ) - - testCases := []struct { - desc string - args *commandargs.Shell - who string - }{ - { - desc: "Provide key id within the request", - args: &commandargs.Shell{GitlabKeyId: "1"}, - who: "key-1", - }, { - desc: "Provide username within the request", - args: &commandargs.Shell{GitlabUsername: "first"}, - who: "user-1", - }, - } - - for _, tc := range testCases { - t.Run(tc.desc, func(t *testing.T) { - result, err := client.Verify(context.Background(), tc.args, uploadPackAction, repo) - require.NoError(t, err) - - response := buildExpectedResponse(tc.who) - response.Gitaly.UseSidechannel = true - require.Equal(t, response, result) - }) - } -} - func TestGeoPushGetCustomAction(t *testing.T) { client := setup(t, map[string]testResponse{ "custom": { |
