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
177264cc
Commit
177264cc
authored
Jun 30, 2020
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo: Refactor replicator-related specs
DRY up specs
parent
55ac007e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
19 deletions
+27
-19
ee/spec/lib/gitlab/geo/registry_batcher_spec.rb
ee/spec/lib/gitlab/geo/registry_batcher_spec.rb
+3
-1
ee/spec/replicators/geo/package_file_replicator_spec.rb
ee/spec/replicators/geo/package_file_replicator_spec.rb
+0
-2
ee/spec/services/geo/registry_consistency_service_spec.rb
ee/spec/services/geo/registry_consistency_service_spec.rb
+1
-1
ee/spec/support/helpers/ee/geo_helpers.rb
ee/spec/support/helpers/ee/geo_helpers.rb
+4
-0
ee/spec/support/shared_examples/models/concerns/replicator_shared_examples.rb
...ed_examples/models/concerns/replicator_shared_examples.rb
+19
-15
No files found.
ee/spec/lib/gitlab/geo/registry_batcher_spec.rb
View file @
177264cc
...
...
@@ -3,11 +3,13 @@
require
'spec_helper'
RSpec
.
describe
Gitlab
::
Geo
::
RegistryBatcher
,
:geo
,
:use_clean_rails_memory_store_caching
do
include
EE
::
GeoHelpers
describe
'#next_range!'
do
let
(
:model_class
)
{
LfsObject
}
let
(
:model_foreign_key
)
{
registry_class
::
MODEL_FOREIGN_KEY
}
let
(
:registry_class
)
{
Geo
::
LfsObjectRegistry
}
let
(
:registry_class_factory
)
{
registry_
class
.
underscore
.
tr
(
'/'
,
'_'
).
to_sym
}
let
(
:registry_class_factory
)
{
registry_
factory_name
(
registry_class
)
}
let
(
:key
)
{
'looping_batcher_spec'
}
let
(
:batch_size
)
{
2
}
...
...
ee/spec/replicators/geo/package_file_replicator_spec.rb
View file @
177264cc
...
...
@@ -6,6 +6,4 @@ RSpec.describe Geo::PackageFileReplicator do
let
(
:model_record
)
{
build
(
:package_file
,
:npm
)
}
include_examples
'a blob replicator'
include_examples
'secondary counters'
,
:geo_package_file_registry
end
ee/spec/services/geo/registry_consistency_service_spec.rb
View file @
177264cc
...
...
@@ -21,7 +21,7 @@ RSpec.describe Geo::RegistryConsistencyService, :geo, :use_clean_rails_memory_st
shared_examples
'registry consistency service'
do
|
klass
|
let
(
:registry_class
)
{
klass
}
let
(
:registry_class_factory
)
{
registry_
class
.
underscore
.
tr
(
'/'
,
'_'
).
to_sym
}
let
(
:registry_class_factory
)
{
registry_
factory_name
(
registry_class
)
}
let
(
:model_class
)
{
registry_class
::
MODEL_CLASS
}
let
(
:model_class_factory
)
{
model_class_factory_name
(
model_class
)
}
let
(
:model_foreign_key
)
{
registry_class
::
MODEL_FOREIGN_KEY
}
...
...
ee/spec/support/helpers/ee/geo_helpers.rb
View file @
177264cc
...
...
@@ -33,6 +33,10 @@ module EE
::
Gitlab
::
ShardHealthCache
.
update
(
Array
(
shards
))
end
def
registry_factory_name
(
registry_class
)
registry_class
.
underscore
.
tr
(
'/'
,
'_'
).
to_sym
end
def
with_no_geo_database_configured
(
&
block
)
allow
(
::
Gitlab
::
Geo
).
to
receive
(
:geo_database_configured?
).
and_return
(
false
)
...
...
ee/spec/support/shared_examples/models/concerns/replicator_shared_examples.rb
View file @
177264cc
...
...
@@ -18,13 +18,15 @@ RSpec.shared_examples 'a replicator' do
expect
{
replicator
.
parent_project_id
}.
not_to
raise_error
end
end
end
RSpec
.
shared_examples
'secondary counters'
do
|
registry_factory_name
|
before
do
create
(
registry_factory_name
,
:synced
)
create
(
registry_factory_name
)
create
(
registry_factory_name
,
:failed
)
context
'Geo node status'
do
context
'on a secondary node'
do
let_it_be
(
:registry_factory
)
{
registry_factory_name
(
described_class
.
registry_class
)
}
before_all
do
create
(
registry_factory
,
:synced
)
create
(
registry_factory
)
create
(
registry_factory
,
:failed
)
end
describe
'.synced_count'
do
...
...
@@ -38,4 +40,6 @@ RSpec.shared_examples 'secondary counters' do |registry_factory_name|
expect
(
described_class
.
failed_count
).
to
eq
(
1
)
end
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