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
5ff87dc8
Commit
5ff87dc8
authored
8 years ago
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs for Geo node's backfill feature
parent
c0eef344
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
26 deletions
+29
-26
spec/models/geo_node_spec.rb
spec/models/geo_node_spec.rb
+24
-24
spec/services/geo/repository_backfill_service_spec.rb
spec/services/geo/repository_backfill_service_spec.rb
+5
-2
No files found.
spec/models/geo_node_spec.rb
View file @
5ff87dc8
...
...
@@ -91,30 +91,6 @@ describe GeoNode, type: :model do
expect
(
node
.
system_hook
.
push_events
).
to
be_truthy
expect
(
node
.
system_hook
.
tag_push_events
).
to
be_truthy
end
context
'backfill mechanism for a secondary node'
do
before
do
Sidekiq
::
Worker
.
clear_all
end
it
'schedules the scheduler worker'
do
Sidekiq
::
Testing
.
fake!
do
expect
{
create
(
:geo_node
,
primary:
false
)
}.
to
change
(
GeoScheduleBackfillWorker
.
jobs
,
:size
).
by
(
1
)
end
end
it
'schedules the correct worker for the number of projects'
do
Sidekiq
::
Testing
.
fake!
do
2
.
times
do
create
(
:project
)
end
create
(
:geo_node
,
primary:
false
)
expect
{
GeoScheduleBackfillWorker
.
drain
}.
to
change
(
GeoBackfillWorker
.
jobs
,
:size
).
by
(
2
)
end
end
end
end
end
...
...
@@ -249,4 +225,28 @@ describe GeoNode, type: :model do
expect
(
node
).
to
be_missing_oauth_application
end
end
describe
'#backfill_repositories'
do
before
do
Sidekiq
::
Worker
.
clear_all
end
it
'schedules the scheduler worker'
do
Sidekiq
::
Testing
.
fake!
do
expect
{
node
.
backfill_repositories
}.
to
change
(
GeoScheduleBackfillWorker
.
jobs
,
:size
).
by
(
1
)
end
end
it
'schedules the correct worker for the number of projects'
do
Sidekiq
::
Testing
.
fake!
do
2
.
times
do
create
(
:project
)
end
node
.
backfill_repositories
expect
{
GeoScheduleBackfillWorker
.
drain
}.
to
change
(
GeoBackfillWorker
.
jobs
,
:size
).
by
(
2
)
end
end
end
end
This diff is collapsed.
Click to expand it.
spec/services/geo/repository_backfill_service_spec.rb
View file @
5ff87dc8
require
'spec_helper'
describe
Geo
::
RepositoryBackfillService
,
services:
true
do
subject
{
Geo
::
RepositoryBackfillService
.
new
(
project
,
geo_node
)
}
SYSTEM_HOOKS_HEADER
=
{
'Content-Type'
=>
'application/json'
,
'X-Gitlab-Event'
=>
'System Hook'
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:geo_node
)
{
create
(
:geo_node
)
}
subject
{
Geo
::
RepositoryBackfillService
.
new
(
project
,
geo_node
)
}
describe
'#execute'
do
it
'calls upon the system hook of the Geo Node'
do
WebMock
.
stub_request
(
:post
,
geo_node
.
geo_events_url
)
...
...
@@ -12,7 +15,7 @@ describe Geo::RepositoryBackfillService, services: true do
subject
.
execute
expect
(
WebMock
).
to
have_requested
(
:post
,
geo_node
.
geo_events_url
).
with
(
headers:
{
'Content-Type'
=>
'application/json'
,
'X-Gitlab-Event'
=>
'System Hook'
}
,
headers:
SYSTEM_HOOKS_HEADER
,
body:
{
event_name:
'push'
,
project_id:
project
.
id
,
...
...
This diff is collapsed.
Click to expand it.
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