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
edccbcb6
Commit
edccbcb6
authored
Sep 07, 2020
by
Arturo Herrero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update module for PropagateServiceTemplate
This is consistent with PropagateIntegrationService.
parent
10013895
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
9 deletions
+8
-9
app/services/admin/propagate_service_template.rb
app/services/admin/propagate_service_template.rb
+1
-1
app/workers/propagate_service_template_worker.rb
app/workers/propagate_service_template_worker.rb
+1
-1
spec/services/admin/propagate_service_template_spec.rb
spec/services/admin/propagate_service_template_spec.rb
+5
-6
spec/workers/propagate_service_template_worker_spec.rb
spec/workers/propagate_service_template_worker_spec.rb
+1
-1
No files found.
app/services/
projects
/propagate_service_template.rb
→
app/services/
admin
/propagate_service_template.rb
View file @
edccbcb6
# frozen_string_literal: true
# frozen_string_literal: true
module
Projects
module
Admin
class
PropagateServiceTemplate
class
PropagateServiceTemplate
BATCH_SIZE
=
100
BATCH_SIZE
=
100
...
...
app/workers/propagate_service_template_worker.rb
View file @
edccbcb6
...
@@ -12,7 +12,7 @@ class PropagateServiceTemplateWorker # rubocop:disable Scalability/IdempotentWor
...
@@ -12,7 +12,7 @@ class PropagateServiceTemplateWorker # rubocop:disable Scalability/IdempotentWor
def
perform
(
template_id
)
def
perform
(
template_id
)
return
unless
try_obtain_lease_for
(
template_id
)
return
unless
try_obtain_lease_for
(
template_id
)
Projects
::
PropagateServiceTemplate
.
propagate
(
Service
.
find_by
(
id:
template_id
))
Admin
::
PropagateServiceTemplate
.
propagate
(
Service
.
find_by
(
id:
template_id
))
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
...
...
spec/services/
projects
/propagate_service_template_spec.rb
→
spec/services/
admin
/propagate_service_template_spec.rb
View file @
edccbcb6
...
@@ -2,10 +2,10 @@
...
@@ -2,10 +2,10 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
Projects
::
PropagateServiceTemplate
do
RSpec
.
describe
Admin
::
PropagateServiceTemplate
do
describe
'.propagate'
do
describe
'.propagate'
do
let!
(
:service_template
)
do
let!
(
:service_template
)
do
PushoverService
.
create
(
PushoverService
.
create
!
(
template:
true
,
template:
true
,
active:
true
,
active:
true
,
push_events:
false
,
push_events:
false
,
...
@@ -31,8 +31,7 @@ RSpec.describe Projects::PropagateServiceTemplate do
...
@@ -31,8 +31,7 @@ RSpec.describe Projects::PropagateServiceTemplate do
end
end
it
'creates services for a project that has another service'
do
it
'creates services for a project that has another service'
do
BambooService
.
create
(
BambooService
.
create!
(
template:
true
,
active:
true
,
active:
true
,
project:
project
,
project:
project
,
properties:
{
properties:
{
...
@@ -51,7 +50,7 @@ RSpec.describe Projects::PropagateServiceTemplate do
...
@@ -51,7 +50,7 @@ RSpec.describe Projects::PropagateServiceTemplate do
end
end
it
'does not create the service if it exists already'
do
it
'does not create the service if it exists already'
do
other_service
=
BambooService
.
create
(
other_service
=
BambooService
.
create
!
(
template:
true
,
template:
true
,
active:
true
,
active:
true
,
properties:
{
properties:
{
...
@@ -110,7 +109,7 @@ RSpec.describe Projects::PropagateServiceTemplate do
...
@@ -110,7 +109,7 @@ RSpec.describe Projects::PropagateServiceTemplate do
let
(
:project_total
)
{
5
}
let
(
:project_total
)
{
5
}
before
do
before
do
stub_const
'Projects::PropagateServiceTemplate::BATCH_SIZE'
,
3
stub_const
(
'Admin::PropagateServiceTemplate::BATCH_SIZE'
,
3
)
project_total
.
times
{
create
(
:project
)
}
project_total
.
times
{
create
(
:project
)
}
...
...
spec/workers/propagate_service_template_worker_spec.rb
View file @
edccbcb6
...
@@ -21,7 +21,7 @@ RSpec.describe PropagateServiceTemplateWorker do
...
@@ -21,7 +21,7 @@ RSpec.describe PropagateServiceTemplateWorker do
stub_exclusive_lease
(
"propagate_service_template_worker:
#{
template
.
id
}
"
,
stub_exclusive_lease
(
"propagate_service_template_worker:
#{
template
.
id
}
"
,
timeout:
PropagateServiceTemplateWorker
::
LEASE_TIMEOUT
)
timeout:
PropagateServiceTemplateWorker
::
LEASE_TIMEOUT
)
expect
(
Projects
::
PropagateServiceTemplate
)
expect
(
Admin
::
PropagateServiceTemplate
)
.
to
receive
(
:propagate
)
.
to
receive
(
:propagate
)
.
with
(
template
)
.
with
(
template
)
...
...
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