Commit 22b9f46d authored by Sean McGivern's avatar Sean McGivern

Merge branch 'pl-notify-resilient' into 'master'

Make NotifyService more robust

See merge request gitlab-org/gitlab-ee!9362
parents 8a3a315f 33b5f0c4
......@@ -63,7 +63,7 @@ module Projects
end
def gitlab_alert_id
alerts.first.dig('labels', 'gitlab_alert_id')
alerts&.first&.dig('labels', 'gitlab_alert_id')
end
def compare_token(expected, actual)
......
......@@ -158,6 +158,12 @@ describe Projects::Prometheus::Alerts::NotifyService do
it_behaves_like 'no notifications'
end
context 'with missing alerts' do
let(:payload) { { 'version' => '4' } }
it_behaves_like 'no notifications'
end
end
private
......
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