diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2016-12-26 20:15:40 +0300 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2017-01-18 20:43:17 +0300 |
commit | 0a1c8bb37cbfe550e7c29b8f30c607cf985466df (patch) | |
tree | 7686e1296ed4935bb8fc79e809411fd44aaa6bc9 /spec/lib/gitlab/workhorse_spec.rb | |
parent | 4b43126d08972c201551fbd1fe42e85847d5e03f (diff) |
Pass Gitaly resource path to gitlab-workhorse if Gitaly is enabled
Diffstat (limited to 'spec/lib/gitlab/workhorse_spec.rb')
-rw-r--r-- | spec/lib/gitlab/workhorse_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/lib/gitlab/workhorse_spec.rb b/spec/lib/gitlab/workhorse_spec.rb index 61da91dcbd3..4b1cd466677 100644 --- a/spec/lib/gitlab/workhorse_spec.rb +++ b/spec/lib/gitlab/workhorse_spec.rb @@ -174,4 +174,27 @@ describe Gitlab::Workhorse, lib: true do described_class.verify_api_request!(headers) end end + + describe '.git_http_ok' do + let(:user) { create(:user) } + + subject { described_class.git_http_ok(repository, user) } + + it { expect(subject).to eq({ GL_ID: "user-#{user.id}", RepoPath: repository.path_to_repo }) } + + context 'when Gitaly socket path is present' do + let(:gitaly_socket_path) { '/tmp/gitaly.sock' } + + before do + allow(Gitlab.config.gitaly).to receive(:socket_path).and_return(gitaly_socket_path) + end + + it 'includes Gitaly params in the returned value' do + expect(subject).to include({ + GitalyResourcePath: "/projects/#{repository.project.id}/git-http/info-refs", + GitalySocketPath: gitaly_socket_path, + }) + end + end + end end |