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
04f2ab93
Commit
04f2ab93
authored
Jan 12, 2018
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve Geo::RepositoriesCleanUpWorker spec with hashed storage examples
parent
475873d2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
9 deletions
+36
-9
spec/ee/spec/workers/geo/repositories_clean_up_worker_spec.rb
.../ee/spec/workers/geo/repositories_clean_up_worker_spec.rb
+36
-9
No files found.
spec/ee/spec/workers/geo/repositories_clean_up_worker_spec.rb
View file @
04f2ab93
...
@@ -12,12 +12,14 @@ describe Geo::RepositoriesCleanUpWorker do
...
@@ -12,12 +12,14 @@ describe Geo::RepositoriesCleanUpWorker do
let
(
:synced_group
)
{
create
(
:group
)
}
let
(
:synced_group
)
{
create
(
:group
)
}
let
(
:geo_node
)
{
create
(
:geo_node
,
namespaces:
[
synced_group
])
}
let
(
:geo_node
)
{
create
(
:geo_node
,
namespaces:
[
synced_group
])
}
context
'legacy storage'
do
it
'performs GeoRepositoryDestroyWorker for each project that does not belong to selected namespaces to replicate'
do
it
'performs GeoRepositoryDestroyWorker for each project that does not belong to selected namespaces to replicate'
do
project_in_synced_group
=
create
(
:project
,
group:
synced_group
)
project_in_synced_group
=
create
(
:project
,
group:
synced_group
)
unsynced_project
=
create
(
:project
,
:repository
)
unsynced_project
=
create
(
:project
,
:repository
)
disk_path
=
"
#{
unsynced_project
.
namespace
.
full_path
}
/
#{
unsynced_project
.
path
}
"
expect
(
GeoRepositoryDestroyWorker
).
to
receive
(
:perform_async
)
expect
(
GeoRepositoryDestroyWorker
).
to
receive
(
:perform_async
)
.
with
(
unsynced_project
.
id
,
unsynced_project
.
name
,
unsynced_project
.
disk_path
,
unsynced_project
.
repository
.
storage
)
.
with
(
unsynced_project
.
id
,
unsynced_project
.
name
,
disk_path
,
unsynced_project
.
repository
.
storage
)
.
once
.
and_return
(
1
)
.
once
.
and_return
(
1
)
expect
(
GeoRepositoryDestroyWorker
).
not_to
receive
(
:perform_async
)
expect
(
GeoRepositoryDestroyWorker
).
not_to
receive
(
:perform_async
)
...
@@ -25,6 +27,31 @@ describe Geo::RepositoriesCleanUpWorker do
...
@@ -25,6 +27,31 @@ describe Geo::RepositoriesCleanUpWorker do
subject
.
perform
(
geo_node
.
id
)
subject
.
perform
(
geo_node
.
id
)
end
end
end
context
'hashed storage'
do
before
do
stub_application_setting
(
hashed_storage_enabled:
true
)
end
it
'performs GeoRepositoryDestroyWorker for each project that does not belong to selected namespaces to replicate'
do
project_in_synced_group
=
create
(
:project
,
group:
synced_group
)
unsynced_project
=
create
(
:project
,
:repository
)
hash
=
Digest
::
SHA2
.
hexdigest
(
unsynced_project
.
id
.
to_s
)
disk_path
=
"@hashed/
#{
hash
[
0
..
1
]
}
/
#{
hash
[
2
..
3
]
}
/
#{
hash
}
"
expect
(
GeoRepositoryDestroyWorker
).
to
receive
(
:perform_async
)
.
with
(
unsynced_project
.
id
,
unsynced_project
.
name
,
disk_path
,
unsynced_project
.
repository
.
storage
)
.
once
.
and_return
(
1
)
expect
(
GeoRepositoryDestroyWorker
).
not_to
receive
(
:perform_async
)
.
with
(
project_in_synced_group
.
id
,
project_in_synced_group
.
name
,
project_in_synced_group
.
disk_path
,
project_in_synced_group
.
repository
.
storage
)
subject
.
perform
(
geo_node
.
id
)
end
end
it
'does not perform GeoRepositoryDestroyWorker when repository does not exist'
do
it
'does not perform GeoRepositoryDestroyWorker when repository does not exist'
do
create
(
:project
)
create
(
:project
)
...
...
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