Commit 36c6c71f authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'sy-fix-global-org-check' into 'master'

Handle errors with repos api

See merge request gitlab-org/gitlab!27426
parents 59885a79 db417054
......@@ -63,6 +63,10 @@ class ErrorTrackingIssueLinkWorker # rubocop:disable Scalability/IdempotentWorke
sentry_client
.repos(organization_slug)
.find { |repo| repo.project_id == issue.project_id && repo.status == 'active' }
rescue Sentry::Client::Error => e
logger.info("Unable to retrieve Sentry repo for organization #{organization_slug}, id #{sentry_issue_id}, with error: #{e.message}")
nil
end
def organization_slug
......
......@@ -95,5 +95,19 @@ describe ErrorTrackingIssueLinkWorker do
it_behaves_like 'attempts to create a link via plugin'
end
context 'when Sentry repos request errors' do
it 'falls back to creating a link via plugin' do
expect_next_instance_of(Sentry::Client) do |client|
expect(client).to receive(:repos).with('sentry-org').and_raise(Sentry::Client::Error)
expect(client)
.to receive(:create_issue_link)
.with(nil, sentry_issue.sentry_issue_identifier, issue)
.and_return(true)
end
expect(subject).to be true
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