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
ab4a98ed
Commit
ab4a98ed
authored
Aug 03, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve spec for Geo::RepositorySyncWorker
parent
67a6ab0f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
spec/workers/geo/repository_sync_worker_spec.rb
spec/workers/geo/repository_sync_worker_spec.rb
+19
-13
No files found.
spec/workers/geo/repository_sync_worker_spec.rb
View file @
ab4a98ed
require
'spec_helper'
describe
Geo
::
RepositorySyncWorker
do
let!
(
:primary
)
{
create
(
:geo_node
,
:primary
,
host:
'primary-geo-node'
)
}
let!
(
:primary
)
{
create
(
:geo_node
,
:primary
,
host:
'primary-geo-node'
)
}
let!
(
:secondary
)
{
create
(
:geo_node
,
:current
)
}
let
(
:
group
)
{
create
(
:group
)
}
let!
(
:project_
1
)
{
create
(
:project
,
group:
group
)
}
let!
(
:
project_2
)
{
create
(
:project
)
}
let
(
:
synced_group
)
{
create
(
:group
)
}
let!
(
:project_
in_synced_group
)
{
create
(
:project
,
group:
synced_
group
)
}
let!
(
:
unsynced_project
)
{
create
(
:project
)
}
subject
{
described_class
.
new
}
...
...
@@ -22,8 +22,8 @@ describe Geo::RepositorySyncWorker do
end
it
'performs Geo::ProjectSyncWorker for projects where last attempt to sync failed'
do
create
(
:geo_project_registry
,
:sync_failed
,
project:
project_
1
)
create
(
:geo_project_registry
,
:synced
,
project:
project_2
)
create
(
:geo_project_registry
,
:sync_failed
,
project:
project_
in_synced_group
)
create
(
:geo_project_registry
,
:synced
,
project:
unsynced_project
)
expect
(
Geo
::
ProjectSyncWorker
).
to
receive
(
:perform_in
).
once
.
and_return
(
spy
)
...
...
@@ -31,8 +31,8 @@ describe Geo::RepositorySyncWorker do
end
it
'performs Geo::ProjectSyncWorker for synced projects updated recently'
do
create
(
:geo_project_registry
,
:synced
,
:repository_dirty
,
project:
project_
1
)
create
(
:geo_project_registry
,
:synced
,
project:
project_2
)
create
(
:geo_project_registry
,
:synced
,
:repository_dirty
,
project:
project_
in_synced_group
)
create
(
:geo_project_registry
,
:synced
,
project:
unsynced_project
)
create
(
:geo_project_registry
,
:synced
,
:wiki_dirty
)
expect
(
Geo
::
ProjectSyncWorker
).
to
receive
(
:perform_in
).
twice
.
and_return
(
spy
)
...
...
@@ -66,20 +66,26 @@ describe Geo::RepositorySyncWorker do
context
'when node has namespace restrictions'
do
before
do
secondary
.
update_attribute
(
:namespaces
,
[
group
])
secondary
.
update_attribute
(
:namespaces
,
[
synced_
group
])
end
it
'does not perform Geo::ProjectSyncWorker for projects that do not belong to selected namespaces to replicate'
do
expect
(
Geo
::
ProjectSyncWorker
).
to
receive
(
:perform_in
).
once
.
and_return
(
spy
)
expect
(
Geo
::
ProjectSyncWorker
).
to
receive
(
:perform_in
)
.
with
(
300
,
project_in_synced_group
.
id
,
within
(
1
.
minute
).
of
(
Time
.
now
))
.
once
.
and_return
(
spy
)
subject
.
perform
end
it
'does not perform Geo::ProjectSyncWorker for synced projects updated recently that do not belong to selected namespaces to replicate'
do
create
(
:geo_project_registry
,
:synced
,
:repository_dirty
,
project:
project_
1
)
create
(
:geo_project_registry
,
:synced
,
:repository_dirty
,
project:
project_2
)
create
(
:geo_project_registry
,
:synced
,
:repository_dirty
,
project:
project_
in_synced_group
)
create
(
:geo_project_registry
,
:synced
,
:repository_dirty
,
project:
unsynced_project
)
expect
(
Geo
::
ProjectSyncWorker
).
to
receive
(
:perform_in
).
once
.
and_return
(
spy
)
expect
(
Geo
::
ProjectSyncWorker
).
to
receive
(
:perform_in
)
.
with
(
300
,
project_in_synced_group
.
id
,
within
(
1
.
minute
).
of
(
Time
.
now
))
.
once
.
and_return
(
spy
)
subject
.
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