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
16dcac56
Commit
16dcac56
authored
Jul 14, 2021
by
Olena Horal-Koretska
Committed by
Vitali Tatarintev
Jul 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce escalation policies [RUN ALL RSPEC] [RUN AS-IF-FOSS]
parent
ef71a0ab
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
2 additions
and
247 deletions
+2
-247
config/feature_flags/development/escalation_policies_mvc.yml
config/feature_flags/development/escalation_policies_mvc.yml
+0
-8
ee/app/models/incident_management/oncall_schedule.rb
ee/app/models/incident_management/oncall_schedule.rb
+0
-31
ee/config/feature_flags/development/escalation_policies_backfill.yml
...eature_flags/development/escalation_policies_backfill.yml
+0
-8
ee/lib/gitlab/incident_management.rb
ee/lib/gitlab/incident_management.rb
+1
-3
ee/spec/controllers/projects/incident_management/escalation_policies_controller_spec.rb
...ncident_management/escalation_policies_controller_spec.rb
+0
-12
ee/spec/finders/incident_management/escalation_policies_finder_spec.rb
...rs/incident_management/escalation_policies_finder_spec.rb
+0
-2
ee/spec/graphql/mutations/incident_management/escalation_policy/create_spec.rb
...ions/incident_management/escalation_policy/create_spec.rb
+0
-1
ee/spec/graphql/mutations/incident_management/escalation_policy/destroy_spec.rb
...ons/incident_management/escalation_policy/destroy_spec.rb
+0
-1
ee/spec/graphql/mutations/incident_management/escalation_policy/update_spec.rb
...ions/incident_management/escalation_policy/update_spec.rb
+0
-1
ee/spec/graphql/resolvers/incident_management/escalation_policies_resolver_spec.rb
.../incident_management/escalation_policies_resolver_spec.rb
+0
-1
ee/spec/lib/gitlab/incident_management_spec.rb
ee/spec/lib/gitlab/incident_management_spec.rb
+0
-9
ee/spec/models/incident_management/oncall_schedule_spec.rb
ee/spec/models/incident_management/oncall_schedule_spec.rb
+0
-92
ee/spec/requests/api/graphql/mutations/incident_management/escalation_policy/create_spec.rb
...ions/incident_management/escalation_policy/create_spec.rb
+0
-13
ee/spec/requests/api/graphql/mutations/incident_management/escalation_policy/destroy_spec.rb
...ons/incident_management/escalation_policy/destroy_spec.rb
+0
-1
ee/spec/requests/api/graphql/mutations/incident_management/escalation_policy/update_spec.rb
...ions/incident_management/escalation_policy/update_spec.rb
+0
-1
ee/spec/requests/api/graphql/project/incident_management/escalation_policies_spec.rb
...l/project/incident_management/escalation_policies_spec.rb
+0
-1
ee/spec/services/alert_management/process_prometheus_alert_service_spec.rb
...alert_management/process_prometheus_alert_service_spec.rb
+0
-9
ee/spec/services/ee/alert_management/alerts/update_service_spec.rb
...ervices/ee/alert_management/alerts/update_service_spec.rb
+0
-9
ee/spec/services/incident_management/escalation_policies/create_service_spec.rb
...ent_management/escalation_policies/create_service_spec.rb
+0
-1
ee/spec/services/incident_management/escalation_policies/destroy_service_spec.rb
...nt_management/escalation_policies/destroy_service_spec.rb
+0
-9
ee/spec/services/incident_management/escalation_policies/update_service_spec.rb
...ent_management/escalation_policies/update_service_spec.rb
+0
-9
ee/spec/services/incident_management/pending_escalations/create_service_spec.rb
...ent_management/pending_escalations/create_service_spec.rb
+0
-1
ee/spec/services/incident_management/pending_escalations/process_service_spec.rb
...nt_management/pending_escalations/process_service_spec.rb
+0
-9
ee/spec/services/projects/alerting/notify_service_spec.rb
ee/spec/services/projects/alerting/notify_service_spec.rb
+0
-13
ee/spec/support/shared_examples/services/alert_management/alert_processing/oncall_notifications_shared_examples.rb
.../alert_processing/oncall_notifications_shared_examples.rb
+1
-2
No files found.
config/feature_flags/development/escalation_policies_mvc.yml
deleted
100644 → 0
View file @
ef71a0ab
---
name
:
escalation_policies_mvc
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60524
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/329347
milestone
:
'
13.12'
type
:
development
group
:
group::monitor
default_enabled
:
false
ee/app/models/incident_management/oncall_schedule.rb
View file @
16dcac56
...
@@ -25,41 +25,10 @@ module IncidentManagement
...
@@ -25,41 +25,10 @@ module IncidentManagement
delegate
:name
,
to: :project
,
prefix:
true
delegate
:name
,
to: :project
,
prefix:
true
after_create
:backfill_escalation_policy
def
default_escalation_rule
EscalationRule
.
new
(
elapsed_time_seconds:
0
,
oncall_schedule:
self
,
status: :acknowledged
)
end
private
private
def
timezones
def
timezones
@timezones
||=
ActiveSupport
::
TimeZone
.
all
.
map
{
|
tz
|
tz
.
tzinfo
.
identifier
}
@timezones
||=
ActiveSupport
::
TimeZone
.
all
.
map
{
|
tz
|
tz
.
tzinfo
.
identifier
}
end
end
# While escalation policies are in development, we want to
# backfill a policy for any project with an OncallSchedule.
# Once escalation policies are enabled, users will need to
# configure a policy directly in order to direct alerts
# to a schedule.
def
backfill_escalation_policy
return
if
::
Feature
.
enabled?
(
:escalation_policies_mvc
,
project
,
default_enabled: :yaml
)
return
if
::
Feature
.
disabled?
(
:escalation_policies_backfill
,
project
,
default_enabled: :yaml
)
if
policy
=
project
.
incident_management_escalation_policies
.
first
policy
.
rules
<<
default_escalation_rule
else
EscalationPolicy
.
create!
(
project:
project
,
name:
'On-call Escalation Policy'
,
description:
"Immediately notify
#{
name
}
"
,
rules:
project
.
incident_management_oncall_schedules
.
map
(
&
:default_escalation_rule
)
)
end
end
end
end
end
end
ee/config/feature_flags/development/escalation_policies_backfill.yml
deleted
100644 → 0
View file @
ef71a0ab
---
name
:
escalation_policies_backfill
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62233
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/268066#implementation-plan
milestone
:
'
14.0'
type
:
development
group
:
group::monitor
default_enabled
:
true
ee/lib/gitlab/incident_management.rb
View file @
16dcac56
...
@@ -7,9 +7,7 @@ module Gitlab
...
@@ -7,9 +7,7 @@ module Gitlab
end
end
def
self
.
escalation_policies_available?
(
project
)
def
self
.
escalation_policies_available?
(
project
)
oncall_schedules_available?
(
project
)
&&
oncall_schedules_available?
(
project
)
&&
project
.
feature_available?
(
:escalation_policies
)
project
.
feature_available?
(
:escalation_policies
)
&&
::
Feature
.
enabled?
(
:escalation_policies_mvc
,
project
,
default_enabled: :yaml
)
end
end
end
end
end
end
ee/spec/controllers/projects/incident_management/escalation_policies_controller_spec.rb
View file @
16dcac56
...
@@ -55,18 +55,6 @@ RSpec.describe Projects::IncidentManagement::EscalationPoliciesController do
...
@@ -55,18 +55,6 @@ RSpec.describe Projects::IncidentManagement::EscalationPoliciesController do
end
end
end
end
context
'with feature flag off'
do
before
do
stub_feature_flags
(
escalation_policies_mvc:
false
)
end
it
'responds with 404'
do
request
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
context
'with unavailable feature'
do
context
'with unavailable feature'
do
before
do
before
do
stub_licensed_features
(
escalation_policies:
false
)
stub_licensed_features
(
escalation_policies:
false
)
...
...
ee/spec/finders/incident_management/escalation_policies_finder_spec.rb
View file @
16dcac56
...
@@ -16,7 +16,6 @@ RSpec.describe IncidentManagement::EscalationPoliciesFinder do
...
@@ -16,7 +16,6 @@ RSpec.describe IncidentManagement::EscalationPoliciesFinder do
context
'when feature is available'
do
context
'when feature is available'
do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
end
end
context
'when user has permissions'
do
context
'when user has permissions'
do
...
@@ -43,7 +42,6 @@ RSpec.describe IncidentManagement::EscalationPoliciesFinder do
...
@@ -43,7 +42,6 @@ RSpec.describe IncidentManagement::EscalationPoliciesFinder do
context
'when feature is not avaiable'
do
context
'when feature is not avaiable'
do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
false
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
false
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
end
end
it
{
is_expected
.
to
eq
(
IncidentManagement
::
EscalationPolicy
.
none
)
}
it
{
is_expected
.
to
eq
(
IncidentManagement
::
EscalationPolicy
.
none
)
}
...
...
ee/spec/graphql/mutations/incident_management/escalation_policy/create_spec.rb
View file @
16dcac56
...
@@ -58,7 +58,6 @@ RSpec.describe Mutations::IncidentManagement::EscalationPolicy::Create do
...
@@ -58,7 +58,6 @@ RSpec.describe Mutations::IncidentManagement::EscalationPolicy::Create do
context
'project has feature'
do
context
'project has feature'
do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
end
end
context
'user has access to project'
do
context
'user has access to project'
do
...
...
ee/spec/graphql/mutations/incident_management/escalation_policy/destroy_spec.rb
View file @
16dcac56
...
@@ -13,7 +13,6 @@ RSpec.describe Mutations::IncidentManagement::EscalationPolicy::Destroy do
...
@@ -13,7 +13,6 @@ RSpec.describe Mutations::IncidentManagement::EscalationPolicy::Destroy do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
end
end
describe
'#resolve'
do
describe
'#resolve'
do
...
...
ee/spec/graphql/mutations/incident_management/escalation_policy/update_spec.rb
View file @
16dcac56
...
@@ -30,7 +30,6 @@ RSpec.describe Mutations::IncidentManagement::EscalationPolicy::Update do
...
@@ -30,7 +30,6 @@ RSpec.describe Mutations::IncidentManagement::EscalationPolicy::Update do
project
.
add_reporter
(
reporter
)
project
.
add_reporter
(
reporter
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
end
end
describe
'#resolve'
do
describe
'#resolve'
do
...
...
ee/spec/graphql/resolvers/incident_management/escalation_policies_resolver_spec.rb
View file @
16dcac56
...
@@ -16,7 +16,6 @@ RSpec.describe Resolvers::IncidentManagement::EscalationPoliciesResolver do
...
@@ -16,7 +16,6 @@ RSpec.describe Resolvers::IncidentManagement::EscalationPoliciesResolver do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
project
.
add_reporter
(
current_user
)
project
.
add_reporter
(
current_user
)
end
end
...
...
ee/spec/lib/gitlab/incident_management_spec.rb
View file @
16dcac56
...
@@ -28,19 +28,10 @@ RSpec.describe Gitlab::IncidentManagement do
...
@@ -28,19 +28,10 @@ RSpec.describe Gitlab::IncidentManagement do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
end
end
it
{
is_expected
.
to
be_truthy
}
it
{
is_expected
.
to
be_truthy
}
context
'when feature flag disabled'
do
before
do
stub_feature_flags
(
escalation_policies_mvc:
false
)
end
it
{
is_expected
.
to
be_falsey
}
end
context
'when escalation policies not avaialble'
do
context
'when escalation policies not avaialble'
do
before
do
before
do
stub_licensed_features
(
escalation_policies:
false
)
stub_licensed_features
(
escalation_policies:
false
)
...
...
ee/spec/models/incident_management/oncall_schedule_spec.rb
View file @
16dcac56
...
@@ -62,96 +62,4 @@ RSpec.describe IncidentManagement::OncallSchedule do
...
@@ -62,96 +62,4 @@ RSpec.describe IncidentManagement::OncallSchedule do
expect
(
described_class
.
for_iid
(
oncall_schedule1
.
iid
)).
to
contain_exactly
(
oncall_schedule1
)
expect
(
described_class
.
for_iid
(
oncall_schedule1
.
iid
)).
to
contain_exactly
(
oncall_schedule1
)
end
end
end
end
describe
'#backfill_escalation_policy'
do
subject
(
:schedule
)
{
create
(
:incident_management_oncall_schedule
,
project:
project
)
}
context
'when the escalation policies feature is disabled'
do
before
do
stub_feature_flags
(
escalation_policies_mvc:
false
)
end
context
'with an existing escalation policy'
do
let_it_be
(
:policy
)
{
create
(
:incident_management_escalation_policy
,
project:
project
)
}
let_it_be
(
:rule
)
{
policy
.
rules
.
first
}
it
'creates an new escalation rule on the existing policy'
do
expect
{
schedule
}
.
to
change
(
::
IncidentManagement
::
EscalationPolicy
,
:count
).
by
(
0
)
.
and
change
(
::
IncidentManagement
::
EscalationRule
,
:count
).
by
(
1
)
expect
(
policy
.
reload
.
rules
.
length
).
to
eq
(
2
)
expect
(
policy
.
rules
.
first
).
to
eq
(
rule
)
expect
(
policy
.
rules
.
second
).
to
have_attributes
(
elapsed_time_seconds:
0
,
oncall_schedule:
schedule
,
status:
'acknowledged'
)
end
end
context
'without an existing escalation policy'
do
let
(
:policy
)
{
::
IncidentManagement
::
EscalationPolicy
.
last!
}
it
'creates a new escalation policy and rule'
do
expect
{
schedule
}
.
to
change
(
::
IncidentManagement
::
EscalationPolicy
,
:count
).
by
(
1
)
.
and
change
(
::
IncidentManagement
::
EscalationRule
,
:count
).
by
(
1
)
expect
(
policy
).
to
have_attributes
(
name:
'On-call Escalation Policy'
,
description:
"Immediately notify
#{
schedule
.
name
}
"
)
expect
(
policy
.
rules
.
length
).
to
eq
(
1
)
expect
(
policy
.
rules
.
first
).
to
have_attributes
(
elapsed_time_seconds:
0
,
oncall_schedule:
schedule
,
status:
'acknowledged'
)
end
context
'with a previously created schedule which has not yet been backfilled'
do
let_it_be
(
:existing_schedule
)
{
create
(
:incident_management_oncall_schedule
,
project:
project
)
}
it
'creates an new escalation rule on the existing policy'
do
expect
{
schedule
}
.
to
change
(
::
IncidentManagement
::
EscalationPolicy
,
:count
).
by
(
1
)
.
and
change
(
::
IncidentManagement
::
EscalationRule
,
:count
).
by
(
2
)
expect
(
policy
.
rules
.
length
).
to
eq
(
2
)
expect
(
policy
.
rules
.
first
).
to
have_attributes
(
elapsed_time_seconds:
0
,
oncall_schedule:
existing_schedule
,
status:
'acknowledged'
)
expect
(
policy
.
rules
.
second
).
to
have_attributes
(
elapsed_time_seconds:
0
,
oncall_schedule:
schedule
,
status:
'acknowledged'
)
end
end
end
context
'when the backfill is disabled directly'
do
before
do
stub_feature_flags
(
escalation_policies_mvc:
false
,
escalation_policies_backfill:
false
)
end
it
'does not alter the escalation policies'
do
expect
{
schedule
}
.
to
not_change
(
::
IncidentManagement
::
EscalationPolicy
,
:count
)
.
and
not_change
(
::
IncidentManagement
::
EscalationRule
,
:count
)
end
end
end
context
'when the escalation policies feature is enabled'
do
it
'does not alter the escalation policies'
do
expect
{
schedule
}
.
to
not_change
(
::
IncidentManagement
::
EscalationPolicy
,
:count
)
.
and
not_change
(
::
IncidentManagement
::
EscalationRule
,
:count
)
end
end
end
end
end
ee/spec/requests/api/graphql/mutations/incident_management/escalation_policy/create_spec.rb
View file @
16dcac56
...
@@ -34,7 +34,6 @@ RSpec.describe 'creating escalation policy' do
...
@@ -34,7 +34,6 @@ RSpec.describe 'creating escalation policy' do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
project
.
add_maintainer
(
current_user
)
project
.
add_maintainer
(
current_user
)
end
end
...
@@ -82,18 +81,6 @@ RSpec.describe 'creating escalation policy' do
...
@@ -82,18 +81,6 @@ RSpec.describe 'creating escalation policy' do
expect
(
mutation_response
[
'errors'
][
0
]).
to
eq
(
'Escalation policies must have at least one rule'
)
expect
(
mutation_response
[
'errors'
][
0
]).
to
eq
(
'Escalation policies must have at least one rule'
)
end
end
end
end
context
'feature flag disabled'
do
before
do
stub_feature_flags
(
escalation_policies_mvc:
false
)
end
it
'raises an error'
do
resolve
expect_graphql_errors_to_include
(
'Escalation policies are not supported for this project'
)
end
end
end
end
def
mutation_response
def
mutation_response
...
...
ee/spec/requests/api/graphql/mutations/incident_management/escalation_policy/destroy_spec.rb
View file @
16dcac56
...
@@ -29,7 +29,6 @@ RSpec.describe 'Removing an escalation policy' do
...
@@ -29,7 +29,6 @@ RSpec.describe 'Removing an escalation policy' do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user
)
end
end
...
...
ee/spec/requests/api/graphql/mutations/incident_management/escalation_policy/update_spec.rb
View file @
16dcac56
...
@@ -49,7 +49,6 @@ RSpec.describe 'Updating an escalation policy' do
...
@@ -49,7 +49,6 @@ RSpec.describe 'Updating an escalation policy' do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user
)
end
end
...
...
ee/spec/requests/api/graphql/project/incident_management/escalation_policies_spec.rb
View file @
16dcac56
...
@@ -29,7 +29,6 @@ RSpec.describe 'getting Incident Management escalation policies' do
...
@@ -29,7 +29,6 @@ RSpec.describe 'getting Incident Management escalation policies' do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
end
end
context
'without project permissions'
do
context
'without project permissions'
do
...
...
ee/spec/services/alert_management/process_prometheus_alert_service_spec.rb
View file @
16dcac56
...
@@ -53,7 +53,6 @@ RSpec.describe AlertManagement::ProcessPrometheusAlertService do
...
@@ -53,7 +53,6 @@ RSpec.describe AlertManagement::ProcessPrometheusAlertService do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
end
end
it_behaves_like
'does not send on-call notification'
it_behaves_like
'does not send on-call notification'
...
@@ -65,14 +64,6 @@ RSpec.describe AlertManagement::ProcessPrometheusAlertService do
...
@@ -65,14 +64,6 @@ RSpec.describe AlertManagement::ProcessPrometheusAlertService do
let!
(
:pending_escalation
)
{
create
(
:incident_management_pending_alert_escalation
,
alert:
target
)
}
let!
(
:pending_escalation
)
{
create
(
:incident_management_pending_alert_escalation
,
alert:
target
)
}
include_examples
"deletes the target's escalations"
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"
end
end
end
end
end
end
end
...
...
ee/spec/services/ee/alert_management/alerts/update_service_spec.rb
View file @
16dcac56
...
@@ -15,7 +15,6 @@ RSpec.describe AlertManagement::Alerts::UpdateService do
...
@@ -15,7 +15,6 @@ RSpec.describe AlertManagement::Alerts::UpdateService do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
end
end
before_all
do
before_all
do
...
@@ -44,14 +43,6 @@ RSpec.describe AlertManagement::Alerts::UpdateService do
...
@@ -44,14 +43,6 @@ RSpec.describe AlertManagement::Alerts::UpdateService do
let
(
:target
)
{
alert
}
let
(
:target
)
{
alert
}
include_examples
"deletes the target's escalations"
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"
end
end
end
context
'moving from a status of the same group'
do
context
'moving from a status of the same group'
do
...
...
ee/spec/services/incident_management/escalation_policies/create_service_spec.rb
View file @
16dcac56
...
@@ -11,7 +11,6 @@ RSpec.describe IncidentManagement::EscalationPolicies::CreateService do
...
@@ -11,7 +11,6 @@ RSpec.describe IncidentManagement::EscalationPolicies::CreateService do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
end
end
before_all
do
before_all
do
...
...
ee/spec/services/incident_management/escalation_policies/destroy_service_spec.rb
View file @
16dcac56
...
@@ -14,7 +14,6 @@ RSpec.describe IncidentManagement::EscalationPolicies::DestroyService do
...
@@ -14,7 +14,6 @@ RSpec.describe IncidentManagement::EscalationPolicies::DestroyService do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
end
end
before_all
do
before_all
do
...
@@ -51,14 +50,6 @@ RSpec.describe IncidentManagement::EscalationPolicies::DestroyService do
...
@@ -51,14 +50,6 @@ RSpec.describe IncidentManagement::EscalationPolicies::DestroyService do
it_behaves_like
'error response'
,
'You have insufficient permissions to configure escalation policies for this project'
it_behaves_like
'error response'
,
'You have insufficient permissions to configure escalation policies for this project'
end
end
context
'when feature is not available'
do
before
do
stub_feature_flags
(
escalation_policies_mvc:
false
)
end
it_behaves_like
'error response'
,
'You have insufficient permissions to configure escalation policies for this project'
end
context
'when an error occurs during removal'
do
context
'when an error occurs during removal'
do
before
do
before
do
allow
(
escalation_policy
).
to
receive
(
:destroy
).
and_return
(
false
)
allow
(
escalation_policy
).
to
receive
(
:destroy
).
and_return
(
false
)
...
...
ee/spec/services/incident_management/escalation_policies/update_service_spec.rb
View file @
16dcac56
...
@@ -41,7 +41,6 @@ RSpec.describe IncidentManagement::EscalationPolicies::UpdateService do
...
@@ -41,7 +41,6 @@ RSpec.describe IncidentManagement::EscalationPolicies::UpdateService do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
end
end
before_all
do
before_all
do
...
@@ -89,14 +88,6 @@ RSpec.describe IncidentManagement::EscalationPolicies::UpdateService do
...
@@ -89,14 +88,6 @@ RSpec.describe IncidentManagement::EscalationPolicies::UpdateService do
it_behaves_like
'error response'
,
'You have insufficient permissions to configure escalation policies for this project'
it_behaves_like
'error response'
,
'You have insufficient permissions to configure escalation policies for this project'
end
end
context
'when feature is not available'
do
before
do
stub_feature_flags
(
escalation_policies_mvc:
false
)
end
it_behaves_like
'error response'
,
'You have insufficient permissions to configure escalation policies for this project'
end
context
'when only new rules are added'
do
context
'when only new rules are added'
do
let
(
:expected_rules
)
{
[
*
escalation_rules
,
new_rule
]
}
let
(
:expected_rules
)
{
[
*
escalation_rules
,
new_rule
]
}
...
...
ee/spec/services/incident_management/pending_escalations/create_service_spec.rb
View file @
16dcac56
...
@@ -23,7 +23,6 @@ RSpec.describe IncidentManagement::PendingEscalations::CreateService do
...
@@ -23,7 +23,6 @@ RSpec.describe IncidentManagement::PendingEscalations::CreateService do
context
'feature available'
do
context
'feature available'
do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
end
end
context
'target is resolved'
do
context
'target is resolved'
do
...
...
ee/spec/services/incident_management/pending_escalations/process_service_spec.rb
View file @
16dcac56
...
@@ -21,7 +21,6 @@ RSpec.describe IncidentManagement::PendingEscalations::ProcessService do
...
@@ -21,7 +21,6 @@ RSpec.describe IncidentManagement::PendingEscalations::ProcessService do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
end
end
describe
'#execute'
do
describe
'#execute'
do
...
@@ -56,14 +55,6 @@ RSpec.describe IncidentManagement::PendingEscalations::ProcessService do
...
@@ -56,14 +55,6 @@ RSpec.describe IncidentManagement::PendingEscalations::ProcessService do
expect
{
execute
}.
to
change
(
Note
,
:count
).
by
(
1
)
expect
{
execute
}.
to
change
(
Note
,
:count
).
by
(
1
)
end
end
context
'feature flag is off'
do
before
do
stub_feature_flags
(
escalation_policies_mvc:
false
)
end
it_behaves_like
'it does not escalate'
end
end
end
context
'target is already resolved'
do
context
'target is already resolved'
do
...
...
ee/spec/services/projects/alerting/notify_service_spec.rb
View file @
16dcac56
...
@@ -16,10 +16,6 @@ RSpec.describe Projects::Alerting::NotifyService do
...
@@ -16,10 +16,6 @@ RSpec.describe Projects::Alerting::NotifyService do
}
}
end
end
before
do
stub_feature_flags
(
escalation_policies_mvc:
false
)
end
subject
{
service
.
execute
(
token
,
integration
)
}
subject
{
service
.
execute
(
token
,
integration
)
}
context
'existing alert with same payload fingerprint'
do
context
'existing alert with same payload fingerprint'
do
...
@@ -101,7 +97,6 @@ RSpec.describe Projects::Alerting::NotifyService do
...
@@ -101,7 +97,6 @@ RSpec.describe Projects::Alerting::NotifyService do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
project
,
escalation_policies:
true
)
stub_licensed_features
(
oncall_schedules:
project
,
escalation_policies:
true
)
stub_feature_flags
(
escalation_policies_mvc:
project
)
end
end
it_behaves_like
'does not send on-call notification'
it_behaves_like
'does not send on-call notification'
...
@@ -129,14 +124,6 @@ RSpec.describe Projects::Alerting::NotifyService do
...
@@ -129,14 +124,6 @@ RSpec.describe Projects::Alerting::NotifyService do
let
(
:target
)
{
alert
}
let
(
:target
)
{
alert
}
include_examples
"deletes the target's escalations"
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"
end
end
end
end
end
end
end
...
...
ee/spec/support/shared_examples/services/alert_management/alert_processing/oncall_notifications_shared_examples.rb
View file @
16dcac56
...
@@ -9,10 +9,9 @@ RSpec.shared_examples 'sends on-call notification if enabled' do
...
@@ -9,10 +9,9 @@ RSpec.shared_examples 'sends on-call notification if enabled' do
it_behaves_like
'sends on-call notification'
it_behaves_like
'sends on-call notification'
context
'
escalation policy features a
re disabled'
do
context
'
with escalation policy featu
re disabled'
do
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
false
)
stub_licensed_features
(
oncall_schedules:
true
,
escalation_policies:
false
)
stub_feature_flags
(
escalation_policies_mvc:
false
)
end
end
it_behaves_like
'sends on-call notification'
it_behaves_like
'sends on-call notification'
...
...
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