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