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
f983eb8c
Commit
f983eb8c
authored
Oct 13, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issuable sla scope
Fix worker spec
parent
e2c3cc8f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
16 deletions
+16
-16
config/sidekiq_queues.yml
config/sidekiq_queues.yml
+2
-0
ee/app/models/issuable_sla.rb
ee/app/models/issuable_sla.rb
+1
-1
ee/app/workers/incident_management/apply_incident_sla_exceeded_label_worker.rb
...nt_management/apply_incident_sla_exceeded_label_worker.rb
+1
-1
ee/spec/services/incident_management/create_incident_sla_exceeded_label_service_spec.rb
...gement/create_incident_sla_exceeded_label_service_spec.rb
+1
-1
ee/spec/workers/incident_management/incident_sla_exceeded_check_worker_spec.rb
...ent_management/incident_sla_exceeded_check_worker_spec.rb
+11
-13
No files found.
config/sidekiq_queues.yml
View file @
f983eb8c
...
...
@@ -142,6 +142,8 @@
-
2
-
-
incident_management
-
2
-
-
incident_management_apply_incident_sla_exceeded_label
-
1
-
-
invalid_gpg_signature_update
-
2
-
-
irker
...
...
ee/app/models/issuable_sla.rb
View file @
f983eb8c
...
...
@@ -4,5 +4,5 @@ class IssuableSla < ApplicationRecord
belongs_to
:issue
,
optional:
false
validates
:due_at
,
presence:
true
scope
:exceeded_for_issues
,
->
{
includes
(
:issue
).
merge
(
Issue
.
opened
).
where
(
'due_at < ?'
,
Time
.
current
)
}
scope
:exceeded_for_issues
,
->
{
includes
(
:issue
).
joins
(
:issue
).
merge
(
Issue
.
opened
).
where
(
'due_at < ?'
,
Time
.
current
)
}
end
ee/app/workers/incident_management/apply_incident_sla_exceeded_label_worker.rb
View file @
f983eb8c
...
...
@@ -8,7 +8,7 @@ module IncidentManagement
feature_category
:incident_management
def
perform
(
incident_id
)
@incident
=
Issue
.
find_by
(
id:
incident_id
)
@incident
=
Issue
.
find_by
_id
(
incident_id
)
@project
=
incident
&
.
project
return
unless
incident
&&
project
...
...
ee/spec/services/incident_management/create_incident_sla_exceeded_label_service_spec.rb
View file @
f983eb8c
...
...
@@ -2,6 +2,6 @@
require
'spec_helper'
RSpec
.
describe
IncidentManagement
::
CreateIncidentLabelService
do
RSpec
.
describe
IncidentManagement
::
CreateIncident
SlaExceeded
LabelService
do
it_behaves_like
'incident management label service'
end
ee/spec/workers/incident_management/incident_sla_exceeded_check_worker_spec.rb
View file @
f983eb8c
...
...
@@ -11,34 +11,32 @@ RSpec.describe IncidentManagement::IncidentSlaExceededCheckWorker do
let_it_be
(
:incident_sla
)
{
create
(
:issuable_sla
,
:exceeded
)
}
let_it_be
(
:other_incident_slas
)
{
create_list
(
:issuable_sla
,
2
,
:exceeded
)
}
let
(
:label_service_stub
)
{
instance_double
(
IncidentManagement
::
ApplyIncidentSlaExceededLabel
Service
,
execute:
true
)
}
let
(
:label_service_stub
)
{
instance_double
(
IncidentManagement
::
ApplyIncidentSlaExceededLabel
Worker
)
}
it
'calls the apply incident sla label service'
do
expect
(
IncidentManagement
::
ApplyIncidentSlaExceededLabel
Service
)
.
to
receive
(
:
new
)
expect
(
IncidentManagement
::
ApplyIncidentSlaExceededLabel
Worker
)
.
to
receive
(
:
perform_async
)
.
exactly
(
3
)
.
and_return
(
label_service_stub
)
expect
(
label_service_stub
).
to
receive
(
:execute
).
exactly
(
3
).
times
.
times
perform
end
context
'when error occurs'
do
before
do
allow
(
IncidentManagement
::
ApplyIncidentSlaExceededLabel
Service
)
.
to
receive
(
:
new
)
.
and_return
(
label_service_stub
)
allow
(
IncidentManagement
::
ApplyIncidentSlaExceededLabel
Worker
)
.
to
receive
(
:
perform_async
)
.
twice
allow
(
IncidentManagement
::
ApplyIncidentSlaExceededLabel
Service
)
.
to
receive
(
:
new
)
.
with
(
incident_sla
.
issue
)
allow
(
IncidentManagement
::
ApplyIncidentSlaExceededLabel
Worker
)
.
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
expect
(
label_service_stub
).
to
receive
(
:execute
).
twice
perform
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