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
4c75a798
Commit
4c75a798
authored
Dec 04, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for Geo::LfsObjectRegistryFinder
parent
d800b5fa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
103 additions
and
0 deletions
+103
-0
spec/ee/spec/finders/geo/lfs_object_registry_finder_spec.rb
spec/ee/spec/finders/geo/lfs_object_registry_finder_spec.rb
+103
-0
No files found.
spec/ee/spec/finders/geo/lfs_object_registry_finder_spec.rb
0 → 100644
View file @
4c75a798
require
'spec_helper'
describe
Geo
::
LfsObjectRegistryFinder
,
:geo
do
include
::
EE
::
GeoHelpers
let
(
:secondary
)
{
create
(
:geo_node
)
}
let
(
:synced_group
)
{
create
(
:group
)
}
let
(
:synced_project
)
{
create
(
:project
,
group:
synced_group
)
}
let
(
:unsynced_project
)
{
create
(
:project
)
}
let
(
:lfs_object_1
)
{
create
(
:lfs_object
)
}
let
(
:lfs_object_2
)
{
create
(
:lfs_object
)
}
let
(
:lfs_object_3
)
{
create
(
:lfs_object
)
}
subject
{
described_class
.
new
(
current_node:
secondary
)
}
before
do
stub_current_geo_node
(
secondary
)
end
describe
'#count_synced_lfs_objects'
do
it
'delegates to #find_synced_lfs_objects_registries'
do
expect
(
subject
).
to
receive
(
:find_synced_lfs_objects_registries
).
and_call_original
subject
.
count_synced_lfs_objects
end
it
'counts LFS objects that has been synced'
do
create
(
:geo_file_registry
,
:lfs
,
file_id:
lfs_object_1
.
id
,
success:
false
)
create
(
:geo_file_registry
,
:lfs
,
file_id:
lfs_object_2
.
id
)
create
(
:geo_file_registry
,
:lfs
,
file_id:
lfs_object_3
.
id
)
expect
(
subject
.
count_synced_lfs_objects
).
to
eq
2
end
context
'with selective sync'
do
before
do
secondary
.
update_attribute
(
:namespaces
,
[
synced_group
])
end
it
'delegates to #legacy_find_synced_lfs_objects'
do
expect
(
subject
).
to
receive
(
:legacy_find_synced_lfs_objects
).
and_call_original
subject
.
count_synced_lfs_objects
end
it
'counts LFS objects that has been synced'
do
allow_any_instance_of
(
LfsObjectsProject
).
to
receive
(
:update_project_statistics
).
and_return
(
nil
)
create
(
:lfs_objects_project
,
project:
synced_project
,
lfs_object:
lfs_object_1
)
create
(
:lfs_objects_project
,
project:
synced_project
,
lfs_object:
lfs_object_2
)
create
(
:lfs_objects_project
,
project:
unsynced_project
,
lfs_object:
lfs_object_3
)
create
(
:geo_file_registry
,
:lfs
,
file_id:
lfs_object_1
.
id
,
success:
false
)
create
(
:geo_file_registry
,
:lfs
,
file_id:
lfs_object_2
.
id
)
create
(
:geo_file_registry
,
:lfs
,
file_id:
lfs_object_3
.
id
)
expect
(
subject
.
count_synced_lfs_objects
).
to
eq
1
end
end
end
describe
'#count_failed_lfs_objects'
do
it
'delegates to #find_failed_lfs_objects_registries'
do
expect
(
subject
).
to
receive
(
:find_failed_lfs_objects_registries
).
and_call_original
subject
.
count_failed_lfs_objects
end
it
'counts LFS objects that sync has failed'
do
create
(
:geo_file_registry
,
:lfs
,
file_id:
lfs_object_1
.
id
,
success:
false
)
create
(
:geo_file_registry
,
:lfs
,
file_id:
lfs_object_2
.
id
)
create
(
:geo_file_registry
,
:lfs
,
file_id:
lfs_object_3
.
id
,
success:
false
)
expect
(
subject
.
count_failed_lfs_objects
).
to
eq
2
end
context
'with selective sync'
do
before
do
secondary
.
update_attribute
(
:namespaces
,
[
synced_group
])
end
it
'delegates to #legacy_find_failed_lfs_objects'
do
expect
(
subject
).
to
receive
(
:legacy_find_failed_lfs_objects
).
and_call_original
subject
.
count_failed_lfs_objects
end
it
'counts LFS objects that sync has failed'
do
allow_any_instance_of
(
LfsObjectsProject
).
to
receive
(
:update_project_statistics
).
and_return
(
nil
)
create
(
:lfs_objects_project
,
project:
synced_project
,
lfs_object:
lfs_object_1
)
create
(
:lfs_objects_project
,
project:
synced_project
,
lfs_object:
lfs_object_2
)
create
(
:lfs_objects_project
,
project:
unsynced_project
,
lfs_object:
lfs_object_3
)
create
(
:geo_file_registry
,
:lfs
,
file_id:
lfs_object_1
.
id
,
success:
false
)
create
(
:geo_file_registry
,
:lfs
,
file_id:
lfs_object_2
.
id
)
create
(
:geo_file_registry
,
:lfs
,
file_id:
lfs_object_3
.
id
,
success:
false
)
expect
(
subject
.
count_failed_lfs_objects
).
to
eq
1
end
end
end
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