diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2017-03-30 18:48:22 +0200 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2017-04-03 13:58:29 +0200 |
commit | 13487809c7fd9994f14babf3e189b434f61692ca (patch) | |
tree | 24a3087d3edaabd301d94883e7f17ceaba1355e2 | |
parent | 88812ce2bf689c65cfd72ff7f6f3537a5b19aafb (diff) | |
download | gitlab-ce-13487809c7fd9994f14babf3e189b434f61692ca.tar.gz |
Pass Gitaly Repository messages to workhorse
-rw-r--r-- | lib/gitlab/workhorse.rb | 12 | ||||
-rw-r--r-- | spec/lib/gitlab/workhorse_spec.rb | 8 |
2 files changed, 17 insertions, 3 deletions
diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb index 6fe85af3c30..d1131ad65e0 100644 --- a/lib/gitlab/workhorse.rb +++ b/lib/gitlab/workhorse.rb @@ -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 diff --git a/spec/lib/gitlab/workhorse_spec.rb b/spec/lib/gitlab/workhorse_spec.rb index 535c96eeee9..cb7c810124e 100644 --- a/spec/lib/gitlab/workhorse_spec.rb +++ b/spec/lib/gitlab/workhorse_spec.rb @@ -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 @@ -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 |