diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-08 12:06:01 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-08 12:06:01 +0000 |
commit | 9865665cb15a1f63e6c4d0623d33b8ef11810f8d (patch) | |
tree | 25458d0f21cf25896af750ed6933bbc4efcdb909 /spec/controllers/projects/git_http_controller_spec.rb | |
parent | 77a7772c3bdb03d92cbc154f6b1a762953cc7c19 (diff) | |
download | gitlab-ce-9865665cb15a1f63e6c4d0623d33b8ef11810f8d.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/projects/git_http_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/git_http_controller_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/controllers/projects/git_http_controller_spec.rb b/spec/controllers/projects/git_http_controller_spec.rb index 88fa2236e33..b756dd5662d 100644 --- a/spec/controllers/projects/git_http_controller_spec.rb +++ b/spec/controllers/projects/git_http_controller_spec.rb @@ -22,5 +22,30 @@ describe Projects::GitHttpController do expect(response.status).to eq(401) end + + context 'with exceptions' do + let(:project) { create(:project, :public, :repository) } + + before do + allow(controller).to receive(:verify_workhorse_api!).and_return(true) + end + + it 'returns 503 with GRPC Unavailable' do + allow(controller).to receive(:access_check).and_raise(GRPC::Unavailable) + + get :info_refs, params: { service: 'git-upload-pack', namespace_id: project.namespace.to_param, project_id: project.path + '.git' } + + expect(response.status).to eq(503) + end + + it 'returns 503 with timeout error' do + allow(controller).to receive(:access_check).and_raise(Gitlab::GitAccess::TimeoutError) + + get :info_refs, params: { service: 'git-upload-pack', namespace_id: project.namespace.to_param, project_id: project.path + '.git' } + + expect(response.status).to eq(503) + expect(response.body).to eq 'Gitlab::GitAccess::TimeoutError' + end + end end end |