Commit f4e8f264 authored by Luke Duncalfe's avatar Luke Duncalfe

Merge branch 'dont_track_sentry_error_for_branches' into 'master'

Don't trigger a sentry error for Gitaly exceptions

See merge request gitlab-org/gitlab!83084
parents 1e23069c c3df27ac
...@@ -34,11 +34,9 @@ class Projects::BranchesController < Projects::ApplicationController ...@@ -34,11 +34,9 @@ class Projects::BranchesController < Projects::ApplicationController
Gitlab::GitalyClient.allow_n_plus_1_calls do Gitlab::GitalyClient.allow_n_plus_1_calls do
render render
end end
rescue Gitlab::Git::CommandError => e rescue Gitlab::Git::CommandError
Gitlab::ErrorTracking.track_exception(e)
@gitaly_unavailable = true @gitaly_unavailable = true
render render status: :service_unavailable
end end
format.json do format.json do
branches = BranchesFinder.new(@repository, params).execute branches = BranchesFinder.new(@repository, params).execute
......
...@@ -688,21 +688,23 @@ RSpec.describe Projects::BranchesController do ...@@ -688,21 +688,23 @@ RSpec.describe Projects::BranchesController do
end end
context 'when gitaly is not available' do context 'when gitaly is not available' do
let(:request) { get :index, format: :html, params: { namespace_id: project.namespace, project_id: project } }
before do before do
allow_next_instance_of(Gitlab::GitalyClient::RefService) do |ref_service| allow_next_instance_of(Gitlab::GitalyClient::RefService) do |ref_service|
allow(ref_service).to receive(:local_branches).and_raise(GRPC::DeadlineExceeded) allow(ref_service).to receive(:local_branches).and_raise(GRPC::DeadlineExceeded)
end end
get :index, format: :html, params: {
namespace_id: project.namespace, project_id: project
}
end end
it 'returns with a status 200' do it 'returns with a status 503' do
expect(response).to have_gitlab_http_status(:ok) request
expect(response).to have_gitlab_http_status(:service_unavailable)
end end
it 'sets gitaly_unavailable variable' do it 'sets gitaly_unavailable variable' do
request
expect(assigns[:gitaly_unavailable]).to be_truthy expect(assigns[:gitaly_unavailable]).to be_truthy
end end
end end
......
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