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
6249f4e3
Commit
6249f4e3
authored
Jun 24, 2021
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't create escalations for existing alerts
- Reorder specs to test this
parent
938fdcec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
22 deletions
+37
-22
ee/app/services/concerns/ee/alert_management/alert_processing.rb
...services/concerns/ee/alert_management/alert_processing.rb
+1
-1
ee/spec/services/incident_management/pending_escalations/process_service_spec.rb
...nt_management/pending_escalations/process_service_spec.rb
+0
-2
ee/spec/services/projects/alerting/notify_service_spec.rb
ee/spec/services/projects/alerting/notify_service_spec.rb
+36
-19
No files found.
ee/app/services/concerns/ee/alert_management/alert_processing.rb
View file @
6249f4e3
...
...
@@ -18,7 +18,7 @@ module EE
def
process_escalations
if
alert
.
resolved?
||
alert
.
ignored?
delete_pending_escalations
els
e
els
if
alert
.
previously_new_record?
create_pending_escalations
end
end
...
...
ee/spec/services/incident_management/pending_escalations/process_service_spec.rb
View file @
6249f4e3
...
...
@@ -5,9 +5,7 @@ require 'spec_helper'
RSpec
.
describe
IncidentManagement
::
PendingEscalations
::
ProcessService
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:schedule_1
)
{
create
(
:incident_management_oncall_schedule
,
:with_rotation
,
project:
project
)
}
let_it_be
(
:schedule_2
)
{
create
(
:incident_management_oncall_schedule
,
:with_rotation
,
project:
project
)
}
let_it_be
(
:schedule_1_users
)
{
schedule_1
.
participants
.
map
(
&
:user
)
}
let_it_be
(
:schedule_2_users
)
{
schedule_2
.
participants
.
map
(
&
:user
)
}
let
(
:escalation_rule
)
{
build
(
:incident_management_escalation_rule
,
oncall_schedule:
schedule_1
)
}
let!
(
:escalation_policy
)
{
create
(
:incident_management_escalation_policy
,
project:
project
,
rules:
[
escalation_rule
])
}
...
...
ee/spec/services/projects/alerting/notify_service_spec.rb
View file @
6249f4e3
...
...
@@ -85,6 +85,17 @@ RSpec.describe Projects::Alerting::NotifyService do
include_examples
'oncall users are correctly notified of firing alert'
context
'with resolving payload'
do
let
(
:payload
)
do
{
'fingerprint'
=>
fingerprint
,
'end_time'
=>
Time
.
current
.
iso8601
}
end
include_examples
'oncall users are correctly notified of recovery alert'
end
context
'with escalation policies ready'
do
let_it_be
(
:policy
)
{
create
(
:incident_management_escalation_policy
,
project:
project
)
}
...
...
@@ -95,32 +106,38 @@ RSpec.describe Projects::Alerting::NotifyService do
it_behaves_like
'does not send on-call notification'
include_examples
'creates an escalation'
,
1
end
context
'with resolving payload'
do
let
(
:payload
)
do
{
'fingerprint'
=>
fingerprint
,
'end_time'
=>
Time
.
current
.
iso8601
}
end
context
'existing alert with same payload fingerprint'
do
let_it_be
(
:alert
)
{
create
(
:alert_management_alert
,
fingerprint:
gitlab_fingerprint
,
project:
project
)
}
let_it_be
(
:pending_escalation
)
{
create
(
:incident_management_pending_alert_escalation
,
alert:
alert
)
}
include_examples
'oncall users are correctly notified of recovery alert'
it
'does not create an escalation'
do
expect
{
subject
}.
not_to
change
{
alert
.
pending_escalations
.
count
}
end
context
'with existing alert escalation'
do
let_it_be
(
:alert
)
{
create
(
:alert_management_alert
,
:ignored
,
fingerprint:
gitlab_fingerprint
,
project:
project
)
}
let_it_be
(
:pending_escalation
)
{
create
(
:incident_management_pending_alert_escalation
,
alert:
alert
)
}
context
'with resolving payload'
do
let
(
:payload
)
do
{
'fingerprint'
=>
fingerprint
,
'end_time'
=>
Time
.
current
.
iso8601
}
end
let
(
:target
)
{
alert
}
context
'with existing alert escalation'
do
let_it_be
(
:pending_escalation
)
{
create
(
:incident_management_pending_alert_escalation
,
alert:
alert
)
}
include_examples
"deletes the target's escalations"
let
(
:target
)
{
alert
}
context
'with escalation policy feature disabled'
do
before
do
stub_feature_flags
(
escalation_policies_mvc:
false
)
end
include_examples
"deletes the target's escalations"
context
'with escalation policy feature disabled'
do
before
do
stub_feature_flags
(
escalation_policies_mvc:
false
)
end
include_examples
"deletes the target's escalations"
include_examples
"deletes the target's escalations"
end
end
end
end
end
...
...
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