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
83f703c7
Commit
83f703c7
authored
Jun 01, 2020
by
Douglas Barbosa Alexandre
Committed by
Mike Kozono
Jun 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor spec for Geo::LfsObjectRegistryFinder
parent
e7021c96
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
279 additions
and
338 deletions
+279
-338
ee/spec/finders/geo/lfs_object_registry_finder_spec.rb
ee/spec/finders/geo/lfs_object_registry_finder_spec.rb
+279
-338
No files found.
ee/spec/finders/geo/lfs_object_registry_finder_spec.rb
View file @
83f703c7
...
...
@@ -2,25 +2,10 @@
require
'spec_helper'
RSpec
.
describe
Geo
::
LfsObjectRegistryFinder
,
:geo_fdw
do
include
::
EE
::
GeoHelpers
# Using let() instead of set() because set() does not work properly
# when using the :delete DatabaseCleaner strategy, which is required for FDW
# tests because a foreign table can't see changes inside a transaction of a
# different connection.
let
(
:secondary
)
{
create
(
:geo_node
)
}
let
(
:synced_group
)
{
create
(
:group
)
}
let
(
:nested_group_1
)
{
create
(
:group
,
parent:
synced_group
)
}
let
(
:synced_project
)
{
create
(
:project
,
group:
synced_group
)
}
let
(
:synced_project_in_nested_group
)
{
create
(
:project
,
group:
nested_group_1
)
}
let
(
:unsynced_project
)
{
create
(
:project
)
}
let
(
:project_broken_storage
)
{
create
(
:project
,
:broken_storage
)
}
subject
{
described_class
.
new
(
current_node_id:
secondary
.
id
)
}
RSpec
.
describe
Geo
::
LfsObjectRegistryFinder
,
:geo
do
let_it_be
(
:secondary
)
{
create
(
:geo_node
)
}
before
do
stub_current_geo_node
(
secondary
)
stub_lfs_object_storage
end
...
...
@@ -33,7 +18,8 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo_fdw do
let!
(
:lfs_object_remote_2
)
{
create
(
:lfs_object
,
:object_storage
)
}
let!
(
:lfs_object_remote_3
)
{
create
(
:lfs_object
,
:object_storage
)
}
context
'counts all the things'
do
subject
{
described_class
.
new
(
current_node_id:
secondary
.
id
)
}
describe
'#count_syncable'
do
it
'counts registries for LFS objects'
do
create
(
:geo_lfs_object_registry
,
:failed
,
lfs_object_id:
lfs_object_1
.
id
)
...
...
@@ -108,18 +94,21 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo_fdw do
expect
(
subject
.
count_synced_missing_on_primary
).
to
eq
3
end
end
end
context
'finds all the things'
do
describe
'#find_registry_differences'
do
let_it_be
(
:synced_group
)
{
create
(
:group
)
}
let_it_be
(
:nested_group_1
)
{
create
(
:group
,
parent:
synced_group
)
}
let_it_be
(
:synced_project
)
{
create
(
:project
,
group:
synced_group
)
}
let_it_be
(
:synced_project_in_nested_group
)
{
create
(
:project
,
group:
nested_group_1
)
}
let_it_be
(
:unsynced_project
)
{
create
(
:project
)
}
let_it_be
(
:project_broken_storage
)
{
create
(
:project
,
:broken_storage
)
}
context
'untracked IDs'
do
before
do
create
(
:geo_lfs_object_registry
,
lfs_object_id:
lfs_object_1
.
id
)
create
(
:geo_lfs_object_registry
,
:failed
,
lfs_object_id:
lfs_object_3
.
id
)
create
(
:geo_lfs_object_registry
,
lfs_object_id:
lfs_object_4
.
id
)
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_in_nested_group
,
lfs_object:
lfs_object_2
)
create
(
:lfs_objects_project
,
project:
synced_project_in_nested_group
,
lfs_object:
lfs_object_3
)
...
...
@@ -343,53 +332,6 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo_fdw do
end
end
# describe '#find_migrated_local' do
# it 'returns LFS objects remotely and successfully synced locally' do
# create(:geo_lfs_object_registry, lfs_object_id: lfs_object_remote_1.id)
# lfs_objects = subject.find_migrated_local(batch_size: 10)
# expect(lfs_objects).to match_ids(lfs_object_remote_1)
# end
# it 'excludes LFS objects stored remotely, but not synced yet' do
# create(:lfs_object, :object_storage)
# lfs_objects = subject.find_migrated_local(batch_size: 10)
# expect(lfs_objects).to be_empty
# end
# it 'excludes synced LFS objects that are stored locally' do
# create(:geo_lfs_object_registry, lfs_object_id: lfs_object_1.id)
# lfs_objects = subject.find_migrated_local(batch_size: 10)
# expect(lfs_objects).to be_empty
# end
# it 'excludes except_ids' do
# create(:geo_lfs_object_registry, lfs_object_id: lfs_object_remote_1.id)
# create(:geo_lfs_object_registry, lfs_object_id: lfs_object_remote_2.id)
# lfs_objects = subject.find_migrated_local(batch_size: 10, except_ids: [lfs_object_remote_1.id])
# expect(lfs_objects).to match_ids(lfs_object_remote_2)
# end
# context 'with object storage sync disabled' do
# let(:secondary) { create(:geo_node, :local_storage_only) }
# it 'returns LFS objects remotely and successfully synced locally' do
# create(:geo_lfs_object_registry, lfs_object_id: lfs_object_remote_1.id)
# lfs_objects = subject.find_migrated_local(batch_size: 10)
# expect(lfs_objects).to match_ids(lfs_object_remote_1)
# end
# end
# end
describe
'#find_retryable_failed_registries'
do
it
'returns registries for LFS objects that have failed to sync'
do
registry_lfs_object_1
=
create
(
:geo_lfs_object_registry
,
:failed
,
lfs_object_id:
lfs_object_1
.
id
)
...
...
@@ -453,7 +395,6 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo_fdw do
expect
(
registries
).
to
match_ids
(
registry_lfs_object_2
)
end
end
end
it_behaves_like
'a file registry finder'
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