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
806255e2
Commit
806255e2
authored
Feb 26, 2019
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the cached version of the current node on selective sync specs
parent
8b33c569
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
ee/spec/workers/geo/file_download_dispatch_worker_spec.rb
ee/spec/workers/geo/file_download_dispatch_worker_spec.rb
+8
-5
ee/spec/workers/geo/repository_shard_sync_worker_spec.rb
ee/spec/workers/geo/repository_shard_sync_worker_spec.rb
+5
-1
No files found.
ee/spec/workers/geo/file_download_dispatch_worker_spec.rb
View file @
806255e2
...
...
@@ -2,14 +2,14 @@ require 'spec_helper'
describe
Geo
::
FileDownloadDispatchWorker
,
:geo
do
include
::
EE
::
GeoHelpers
include
ExclusiveLeaseHelpers
let
(
:primary
)
{
create
(
:geo_node
,
:primary
,
host:
'primary-geo-node'
)
}
let
(
:secondary
)
{
create
(
:geo_node
)
}
before
do
stub_current_geo_node
(
secondary
)
allow_any_instance_of
(
Gitlab
::
ExclusiveLease
).
to
receive
(
:try_obtain
).
and_return
(
true
)
allow_any_instance_of
(
Gitlab
::
ExclusiveLease
).
to
receive
(
:renew
).
and_return
(
true
)
stub_exclusive_lease
(
renew:
true
)
allow_any_instance_of
(
described_class
).
to
receive
(
:over_time?
).
and_return
(
false
)
WebMock
.
stub_request
(
:get
,
/primary-geo-node/
).
to_return
(
status:
200
,
body:
""
,
headers:
{})
end
...
...
@@ -347,15 +347,18 @@ describe Geo::FileDownloadDispatchWorker, :geo do
end
end
context
'when node has namespace restrictions'
do
context
'when node has namespace restrictions'
,
:request_store
do
let
(
:synced_group
)
{
create
(
:group
)
}
let
(
:project_in_synced_group
)
{
create
(
:project
,
group:
synced_group
)
}
let
(
:unsynced_project
)
{
create
(
:project
)
}
before
do
allow
(
ProjectCacheWorker
).
to
receive
(
:perform_async
).
and_return
(
true
)
secondary
.
update!
(
selective_sync_type:
'namespaces'
,
namespaces:
[
synced_group
])
allow
(
ProjectCacheWorker
).
to
receive
(
:perform_async
).
and_return
(
true
)
allow
(
::
Gitlab
::
Geo
).
to
receive
(
:current_node
).
and_call_original
Rails
.
cache
.
write
(
:current_node
,
secondary
.
to_json
)
allow
(
::
GeoNode
).
to
receive
(
:current_node
).
and_return
(
secondary
)
end
it
'does not perform Geo::FileDownloadWorker for LFS object that does not belong to selected namespaces to replicate'
do
...
...
ee/spec/workers/geo/repository_shard_sync_worker_spec.rb
View file @
806255e2
...
...
@@ -115,9 +115,13 @@ describe Geo::RepositoryShardSyncWorker, :geo, :delete, :clean_gitlab_redis_cach
end
end
context
'when node has namespace restrictions'
do
context
'when node has namespace restrictions'
,
:request_store
do
before
do
secondary
.
update!
(
selective_sync_type:
'namespaces'
,
namespaces:
[
restricted_group
])
allow
(
::
Gitlab
::
Geo
).
to
receive
(
:current_node
).
and_call_original
Rails
.
cache
.
write
(
:current_node
,
secondary
.
to_json
)
allow
(
::
GeoNode
).
to
receive
(
:current_node
).
and_return
(
secondary
)
end
it
'does not perform Geo::ProjectSyncWorker for projects that do not belong to selected namespaces to replicate'
do
...
...
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