Commit 5b0f3acd authored by Nick Thomas's avatar Nick Thomas

Pass GL_USERNAME from GitLab to Gitaly

parent 11677f52
......@@ -31,8 +31,9 @@ func TestFailedCloneNoGitaly(t *testing.T) {
require.NoError(t, os.RemoveAll(scratchDir))
authBody := &api.Response{
GL_ID: "user-123",
RepoPath: repoPath(t),
GL_ID: "user-123",
GL_USERNAME: "username",
RepoPath: repoPath(t),
// This will create a failure to connect to Gitaly
GitalyServer: gitaly.Server{Address: "unix:/nonexistent"},
}
......@@ -132,6 +133,7 @@ func TestPostReceivePackProxiedToGitalySuccessfully(t *testing.T) {
apiResponse.Repository.StorageName,
apiResponse.Repository.RelativePath,
apiResponse.GL_ID,
apiResponse.GL_USERNAME,
string(testhelper.GitalyReceivePackResponseMock),
}, "\000")
......
......@@ -52,7 +52,7 @@ func handleReceivePackWithGitaly(ctx context.Context, a *api.Response, clientReq
return fmt.Errorf("smarthttp.ReceivePack: %v", err)
}
if err := smarthttp.ReceivePack(ctx, &a.Repository, a.GL_ID, a.GL_REPOSITORY, clientRequest, clientResponse); err != nil {
if err := smarthttp.ReceivePack(ctx, &a.Repository, a.GL_ID, a.GL_USERNAME, a.GL_REPOSITORY, clientRequest, clientResponse); err != nil {
return fmt.Errorf("smarthttp.ReceivePack: %v", err)
}
......
......@@ -39,7 +39,7 @@ func infoRefsReader(stream infoRefsClient) io.Reader {
})
}
func (client *SmartHTTPClient) ReceivePack(ctx context.Context, repo *pb.Repository, glId string, glRepository string, clientRequest io.Reader, clientResponse io.Writer) error {
func (client *SmartHTTPClient) ReceivePack(ctx context.Context, repo *pb.Repository, glId string, glUsername string, glRepository string, clientRequest io.Reader, clientResponse io.Writer) error {
stream, err := client.PostReceivePack(ctx)
if err != nil {
return err
......@@ -48,6 +48,7 @@ func (client *SmartHTTPClient) ReceivePack(ctx context.Context, repo *pb.Reposit
rpcRequest := &pb.PostReceivePackRequest{
Repository: repo,
GlId: glId,
GlUsername: glUsername,
GlRepository: glRepository,
}
......
......@@ -99,6 +99,7 @@ func (s *GitalyTestServer) PostReceivePack(stream pb.SmartHTTPService_PostReceiv
repo.GetStorageName(),
repo.GetRelativePath(),
req.GlId,
req.GlUsername,
}, "\000") + "\000")
// The body of the request starts in the second message
......
......@@ -722,8 +722,9 @@ func runOrFail(t *testing.T, cmd *exec.Cmd) {
func gitOkBody(t *testing.T) *api.Response {
repoPath := repoPath(t)
return &api.Response{
GL_ID: "user-123",
RepoPath: repoPath,
GL_ID: "user-123",
GL_USERNAME: "username",
RepoPath: repoPath,
Repository: pb.Repository{
StorageName: "default",
RelativePath: "foo/bar.git",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment