Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
33b5f0c4
Commit
33b5f0c4
authored
Jan 30, 2019
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make NotifyService more robust
Be resilient if `alerts` are missing in the payload.
parent
1486304d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
ee/app/services/projects/prometheus/alerts/notify_service.rb
ee/app/services/projects/prometheus/alerts/notify_service.rb
+1
-1
ee/spec/services/projects/prometheus/alerts/notify_service_spec.rb
...ervices/projects/prometheus/alerts/notify_service_spec.rb
+6
-0
No files found.
ee/app/services/projects/prometheus/alerts/notify_service.rb
View file @
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
)
...
...
ee/spec/services/projects/prometheus/alerts/notify_service_spec.rb
View file @
33b5f0c4
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment