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
4d7dbe7e
Commit
4d7dbe7e
authored
Sep 18, 2020
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create add_severity_system_note feature flag
Hide adding a severity system note behind feature flag
parent
0deaeb61
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
22 deletions
+54
-22
app/services/system_notes/incident_service.rb
app/services/system_notes/incident_service.rb
+2
-0
config/feature_flags/development/add_severity_system_note.yml
...ig/feature_flags/development/add_severity_system_note.yml
+7
-0
spec/services/system_notes/incident_service_spec.rb
spec/services/system_notes/incident_service_spec.rb
+45
-22
No files found.
app/services/system_notes/incident_service.rb
View file @
4d7dbe7e
...
...
@@ -10,6 +10,8 @@ module SystemNotes
#
# Returns the created Note object
def
change_incident_severity
return
unless
Feature
.
enabled?
(
:add_severity_system_note
,
noteable
.
project
)
severity
=
noteable
.
severity
if
severity_label
=
IssuableSeverity
::
SEVERITY_LABELS
[
severity
.
to_sym
]
...
...
config/feature_flags/development/add_severity_system_note.yml
0 → 100644
View file @
4d7dbe7e
---
name
:
add_severity_system_note
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42358
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/251110
group
:
group::health
type
:
development
default_enabled
:
false
spec/services/system_notes/incident_service_spec.rb
View file @
4d7dbe7e
...
...
@@ -11,6 +11,15 @@ RSpec.describe ::SystemNotes::IncidentService do
describe
'#change_incident_severity'
do
subject
(
:change_severity
)
{
described_class
.
new
(
noteable:
noteable
,
project:
project
,
author:
author
).
change_incident_severity
}
before
do
allow
(
Gitlab
::
AppLogger
).
to
receive
(
:error
).
and_call_original
end
context
'with add_severity_system_note feature flag enabled'
do
before
do
stub_feature_flags
(
add_severity_system_note:
project
)
end
it_behaves_like
'a system note'
do
let
(
:action
)
{
'severity'
}
end
...
...
@@ -34,7 +43,6 @@ RSpec.describe ::SystemNotes::IncidentService do
before
do
allow
(
noteable
).
to
receive
(
:severity
).
and_return
(
invalid_severity
)
allow
(
Gitlab
::
AppLogger
).
to
receive
(
:error
).
and_call_original
end
it
'does not create system note'
do
...
...
@@ -53,4 +61,19 @@ RSpec.describe ::SystemNotes::IncidentService do
end
end
end
context
'with add_severity_system_note feature flag disabled'
do
before
do
stub_feature_flags
(
add_severity_system_note:
false
)
end
it
'does not create system note'
do
expect
{
change_severity
}.
not_to
change
{
noteable
.
notes
.
count
}
end
it
'does not write error to logs'
do
expect
(
Gitlab
::
AppLogger
).
not_to
have_received
(
:error
)
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