Skip to content
Snippets Groups Projects
Commit 13487809 authored by Jacob Vosmaer (GitLab)'s avatar Jacob Vosmaer (GitLab)
Browse files

Pass Gitaly Repository messages to workhorse

parent 88812ce2
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -17,14 +17,22 @@ module Gitlab
 
class << self
def git_http_ok(repository, user)
repo_path = repository.path_to_repo
params = {
GL_ID: Gitlab::GlId.gl_id(user),
RepoPath: repository.path_to_repo,
RepoPath: repo_path,
}
 
if Gitlab.config.gitaly.enabled
address = Gitlab::GitalyClient.get_address(repository.project.repository_storage)
storage = repository.project.repository_storage
address = Gitlab::GitalyClient.get_address(storage)
params[:GitalySocketPath] = URI(address).path
# TODO: use GitalyClient code to assemble the Repository message
params[:Repository] = Gitaly::Repository.new(
path: repo_path,
storage_name: storage,
relative_path: Gitlab::RepoPath.strip_storage_path(repo_path),
).to_h
end
 
params
Loading
Loading
Loading
Loading
@@ -179,10 +179,11 @@ describe Gitlab::Workhorse, lib: true do
 
describe '.git_http_ok' do
let(:user) { create(:user) }
let(:repo_path) { repository.path_to_repo }
 
subject { described_class.git_http_ok(repository, user) }
 
it { expect(subject).to eq({ GL_ID: "user-#{user.id}", RepoPath: repository.path_to_repo }) }
it { expect(subject).to eq({ GL_ID: "user-#{user.id}", RepoPath: repo_path }) }
 
context 'when Gitaly is enabled' do
before do
Loading
Loading
@@ -192,6 +193,11 @@ describe Gitlab::Workhorse, lib: true do
it 'includes Gitaly params in the returned value' do
gitaly_socket_path = URI(Gitlab::GitalyClient.get_address('default')).path
expect(subject).to include({ GitalySocketPath: gitaly_socket_path })
expect(subject[:Repository]).to include({
path: repo_path,
storage_name: 'default',
relative_path: project.full_path + '.git',
})
end
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment