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
084cd09f
Commit
084cd09f
authored
Oct 14, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update sla label specs
- add changelog
parent
f983eb8c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
26 deletions
+8
-26
changelogs/unreleased/241663-incident-sla-cron-job.yml
changelogs/unreleased/241663-incident-sla-cron-job.yml
+5
-0
ee/app/workers/incident_management/incident_sla_exceeded_check_worker.rb
...incident_management/incident_sla_exceeded_check_worker.rb
+1
-4
ee/spec/workers/incident_management/apply_incident_sla_exceeded_label_worker_spec.rb
...nagement/apply_incident_sla_exceeded_label_worker_spec.rb
+2
-2
ee/spec/workers/incident_management/incident_sla_exceeded_check_worker_spec.rb
...ent_management/incident_sla_exceeded_check_worker_spec.rb
+0
-20
No files found.
changelogs/unreleased/241663-incident-sla-cron-job.yml
0 → 100644
View file @
084cd09f
---
title
:
Add Missed SLA label via Cron job
merge_request
:
44546
author
:
type
:
added
ee/app/workers/incident_management/incident_sla_exceeded_check_worker.rb
View file @
084cd09f
...
...
@@ -11,10 +11,7 @@ module IncidentManagement
def
perform
IssuableSla
.
exceeded_for_issues
.
find_in_batches
do
|
incident_slas
|
incident_slas
.
each
do
|
incident_sla
|
ApplyIncidentSlaExceededLabelWorker
.
perform_async
(
incident_sla
.
issue
.
id
)
rescue
StandardError
=>
e
Gitlab
::
AppLogger
.
error
(
"Error encountered in
#{
self
.
class
.
name
}
:
#{
e
}
"
)
ApplyIncidentSlaExceededLabelWorker
.
perform_async
(
incident_sla
.
issue_id
)
end
end
end
...
...
ee/spec/workers/incident_management/apply_incident_sla_exceeded_label_worker_spec.rb
View file @
084cd09f
...
...
@@ -29,9 +29,9 @@ RSpec.describe IncidentManagement::ApplyIncidentSlaExceededLabelWorker do
it
'adds a label to the incident'
do
expect
{
perform
}.
to
change
{
incident
.
labels
.
reload
.
count
}.
by
(
1
)
expected_
props
=
IncidentManagement
::
CreateIncidentSlaExceededLabelService
::
LABEL_PROPERTIES
expected_
label
=
project
.
labels
.
find_by!
(
IncidentManagement
::
CreateIncidentSlaExceededLabelService
::
LABEL_PROPERTIES
)
expect
(
perform
).
to
have_attributes
(
expected_props
)
expect
(
perform
).
to
eq
(
expected_label
)
end
it
'adds a note that the label was added'
do
...
...
ee/spec/workers/incident_management/incident_sla_exceeded_check_worker_spec.rb
View file @
084cd09f
...
...
@@ -21,25 +21,5 @@ RSpec.describe IncidentManagement::IncidentSlaExceededCheckWorker do
perform
end
context
'when error occurs'
do
before
do
allow
(
IncidentManagement
::
ApplyIncidentSlaExceededLabelWorker
)
.
to
receive
(
:perform_async
)
.
twice
allow
(
IncidentManagement
::
ApplyIncidentSlaExceededLabelWorker
)
.
to
receive
(
:perform_async
)
.
with
(
incident_sla
.
issue
.
id
)
.
and_raise
(
'test'
)
.
once
end
it
'logs the error and continues to run the others'
do
expect
(
Gitlab
::
AppLogger
).
to
receive
(
:error
).
once
perform
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