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
82f5bb0e
Commit
82f5bb0e
authored
Oct 12, 2020
by
Mike Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename replicables_for_geo_node method
...to replicables_for_current_secondary
parent
ed23254b
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
42 additions
and
42 deletions
+42
-42
doc/development/geo/framework.md
doc/development/geo/framework.md
+1
-1
ee/app/models/concerns/geo/blob_replicator_strategy.rb
ee/app/models/concerns/geo/blob_replicator_strategy.rb
+1
-1
ee/app/models/concerns/geo/repository_replicator_strategy.rb
ee/app/models/concerns/geo/repository_replicator_strategy.rb
+1
-1
ee/app/models/ee/ci/job_artifact.rb
ee/app/models/ee/ci/job_artifact.rb
+1
-1
ee/app/models/ee/container_repository.rb
ee/app/models/ee/container_repository.rb
+1
-1
ee/app/models/ee/lfs_object.rb
ee/app/models/ee/lfs_object.rb
+1
-1
ee/app/models/ee/merge_request_diff.rb
ee/app/models/ee/merge_request_diff.rb
+1
-1
ee/app/models/ee/packages/package_file.rb
ee/app/models/ee/packages/package_file.rb
+1
-1
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+1
-1
ee/app/models/ee/snippet_repository.rb
ee/app/models/ee/snippet_repository.rb
+1
-1
ee/app/models/ee/terraform/state_version.rb
ee/app/models/ee/terraform/state_version.rb
+1
-1
ee/app/models/ee/upload.rb
ee/app/models/ee/upload.rb
+1
-1
ee/app/models/geo/base_registry.rb
ee/app/models/geo/base_registry.rb
+1
-1
ee/app/models/geo/upload_registry.rb
ee/app/models/geo/upload_registry.rb
+1
-1
ee/lib/gitlab/geo/replicable_model.rb
ee/lib/gitlab/geo/replicable_model.rb
+2
-2
ee/lib/gitlab/geo/replicator.rb
ee/lib/gitlab/geo/replicator.rb
+1
-1
ee/spec/lib/gitlab/geo/replicable_model_spec.rb
ee/spec/lib/gitlab/geo/replicable_model_spec.rb
+4
-4
ee/spec/lib/gitlab/geo/replicator_spec.rb
ee/spec/lib/gitlab/geo/replicator_spec.rb
+2
-2
ee/spec/models/ee/ci/job_artifact_spec.rb
ee/spec/models/ee/ci/job_artifact_spec.rb
+2
-2
ee/spec/models/ee/merge_request_diff_spec.rb
ee/spec/models/ee/merge_request_diff_spec.rb
+4
-4
ee/spec/models/ee/terraform/state_version_spec.rb
ee/spec/models/ee/terraform/state_version_spec.rb
+2
-2
ee/spec/models/packages/package_file_spec.rb
ee/spec/models/packages/package_file_spec.rb
+2
-2
ee/spec/models/upload_spec.rb
ee/spec/models/upload_spec.rb
+2
-2
ee/spec/support/helpers/ee/geo_helpers.rb
ee/spec/support/helpers/ee/geo_helpers.rb
+1
-1
ee/spec/support/shared_examples/models/concerns/blob_replicator_strategy_shared_examples.rb
...dels/concerns/blob_replicator_strategy_shared_examples.rb
+2
-2
ee/spec/support/shared_examples/models/concerns/replicable_model_shared_examples.rb
...mples/models/concerns/replicable_model_shared_examples.rb
+2
-2
ee/spec/support/shared_examples/models/concerns/repository_replicator_strategy_shared_examples.rb
...oncerns/repository_replicator_strategy_shared_examples.rb
+2
-2
No files found.
doc/development/geo/framework.md
View file @
82f5bb0e
...
@@ -199,7 +199,7 @@ For example, to add support for files referenced by a `Widget` model with a
...
@@ -199,7 +199,7 @@ For example, to add support for files referenced by a `Widget` model with a
# @param primary_key_in [Range, Widget] arg to pass to primary_key_in scope
# @param primary_key_in [Range, Widget] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<Widget>] everything that should be synced to this node, restricted by primary key
# @return [ActiveRecord::Relation<Widget>] everything that should be synced to this node, restricted by primary key
def
self
.
replicables_for_
geo_node
(
primary_key_in
)
def
self
.
replicables_for_
current_secondary
(
primary_key_in
)
# Should be implemented. The idea of the method is to restrict
# Should be implemented. The idea of the method is to restrict
# the set of synced items depending on synchronization settings
# the set of synced items depending on synchronization settings
end
end
...
...
ee/app/models/concerns/geo/blob_replicator_strategy.rb
View file @
82f5bb0e
...
@@ -22,7 +22,7 @@ module Geo
...
@@ -22,7 +22,7 @@ module Geo
# Called by Gitlab::Geo::Replicator#consume
# Called by Gitlab::Geo::Replicator#consume
def
consume_event_created
(
**
params
)
def
consume_event_created
(
**
params
)
return
unless
in_replicables_for_
geo_node
?
return
unless
in_replicables_for_
current_secondary
?
download
download
end
end
...
...
ee/app/models/concerns/geo/repository_replicator_strategy.rb
View file @
82f5bb0e
...
@@ -15,7 +15,7 @@ module Geo
...
@@ -15,7 +15,7 @@ module Geo
# Called by Gitlab::Geo::Replicator#consume
# Called by Gitlab::Geo::Replicator#consume
def
consume_event_updated
(
**
params
)
def
consume_event_updated
(
**
params
)
return
unless
in_replicables_for_
geo_node
?
return
unless
in_replicables_for_
current_secondary
?
sync_repository
sync_repository
end
end
...
...
ee/app/models/ee/ci/job_artifact.rb
View file @
82f5bb0e
...
@@ -84,7 +84,7 @@ module EE
...
@@ -84,7 +84,7 @@ module EE
# @param primary_key_in [Range, Ci::JobArtifact] arg to pass to primary_key_in scope
# @param primary_key_in [Range, Ci::JobArtifact] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<Ci::JobArtifact>] everything that should be synced to this node, restricted by primary key
# @return [ActiveRecord::Relation<Ci::JobArtifact>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
node
=
::
Gitlab
::
Geo
.
current_node
node
=
::
Gitlab
::
Geo
.
current_node
not_expired
not_expired
...
...
ee/app/models/ee/container_repository.rb
View file @
82f5bb0e
...
@@ -11,7 +11,7 @@ module EE
...
@@ -11,7 +11,7 @@ module EE
class_methods
do
class_methods
do
# @param primary_key_in [Range, ContainerRepository] arg to pass to primary_key_in scope
# @param primary_key_in [Range, ContainerRepository] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<ContainerRepository>] everything that should be synced to this node, restricted by primary key
# @return [ActiveRecord::Relation<ContainerRepository>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
node
=
::
Gitlab
::
Geo
.
current_node
node
=
::
Gitlab
::
Geo
.
current_node
node
.
container_repositories
.
primary_key_in
(
primary_key_in
)
node
.
container_repositories
.
primary_key_in
(
primary_key_in
)
...
...
ee/app/models/ee/lfs_object.rb
View file @
82f5bb0e
...
@@ -19,7 +19,7 @@ module EE
...
@@ -19,7 +19,7 @@ module EE
class_methods
do
class_methods
do
# @param primary_key_in [Range, LfsObject] arg to pass to primary_key_in scope
# @param primary_key_in [Range, LfsObject] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<LfsObject>] everything that should be synced to this node, restricted by primary key
# @return [ActiveRecord::Relation<LfsObject>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
node
=
::
Gitlab
::
Geo
.
current_node
node
=
::
Gitlab
::
Geo
.
current_node
local_storage_only
=
!
node
.
sync_object_storage
local_storage_only
=
!
node
.
sync_object_storage
...
...
ee/app/models/ee/merge_request_diff.rb
View file @
82f5bb0e
...
@@ -31,7 +31,7 @@ module EE
...
@@ -31,7 +31,7 @@ module EE
class_methods
do
class_methods
do
# @param primary_key_in [Range, MergeRequestDiff] arg to pass to primary_key_in scope
# @param primary_key_in [Range, MergeRequestDiff] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<MergeRequestDiff>] everything that should be synced to this node, restricted by primary key
# @return [ActiveRecord::Relation<MergeRequestDiff>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
node
=
::
Gitlab
::
Geo
.
current_node
node
=
::
Gitlab
::
Geo
.
current_node
has_external_diffs
.
primary_key_in
(
primary_key_in
)
has_external_diffs
.
primary_key_in
(
primary_key_in
)
...
...
ee/app/models/ee/packages/package_file.rb
View file @
82f5bb0e
...
@@ -13,7 +13,7 @@ module EE
...
@@ -13,7 +13,7 @@ module EE
class_methods
do
class_methods
do
# @param primary_key_in [Range, Packages::PackageFile] arg to pass to primary_key_in scope
# @param primary_key_in [Range, Packages::PackageFile] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<LfsObject>] everything that should be synced to this node, restricted by primary key
# @return [ActiveRecord::Relation<LfsObject>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
primary_key_in
(
primary_key_in
)
primary_key_in
(
primary_key_in
)
.
merge
(
selective_sync_scope
)
.
merge
(
selective_sync_scope
)
.
merge
(
object_storage_scope
)
.
merge
(
object_storage_scope
)
...
...
ee/app/models/ee/project.rb
View file @
82f5bb0e
...
@@ -206,7 +206,7 @@ module EE
...
@@ -206,7 +206,7 @@ module EE
# @param primary_key_in [Range, Project] arg to pass to primary_key_in scope
# @param primary_key_in [Range, Project] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<Project>] everything that should be synced to this node, restricted by primary key
# @return [ActiveRecord::Relation<Project>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
node
=
::
Gitlab
::
Geo
.
current_node
node
=
::
Gitlab
::
Geo
.
current_node
node
.
projects
.
primary_key_in
(
primary_key_in
)
node
.
projects
.
primary_key_in
(
primary_key_in
)
...
...
ee/app/models/ee/snippet_repository.rb
View file @
82f5bb0e
...
@@ -13,7 +13,7 @@ module EE
...
@@ -13,7 +13,7 @@ module EE
class_methods
do
class_methods
do
# @param primary_key_in [Range, SnippetRepository] arg to pass to primary_key_in scope
# @param primary_key_in [Range, SnippetRepository] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<SnippetRepository>] everything that should be synced to this node, restricted by primary key
# @return [ActiveRecord::Relation<SnippetRepository>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
# Not implemented yet. Should be responsible for selective sync
# Not implemented yet. Should be responsible for selective sync
all
all
end
end
...
...
ee/app/models/ee/terraform/state_version.rb
View file @
82f5bb0e
...
@@ -16,7 +16,7 @@ module EE
...
@@ -16,7 +16,7 @@ module EE
class_methods
do
class_methods
do
# @param primary_key_in [Range, Terraform::StateVersion] arg to pass to primary_key_in scope
# @param primary_key_in [Range, Terraform::StateVersion] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<Terraform::StateVersion>] everything that should be synced to this node, restricted by primary key
# @return [ActiveRecord::Relation<Terraform::StateVersion>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
node
=
::
Gitlab
::
Geo
.
current_node
node
=
::
Gitlab
::
Geo
.
current_node
primary_key_in
(
primary_key_in
)
primary_key_in
(
primary_key_in
)
...
...
ee/app/models/ee/upload.rb
View file @
82f5bb0e
...
@@ -20,7 +20,7 @@ module EE
...
@@ -20,7 +20,7 @@ module EE
class_methods
do
class_methods
do
# @param primary_key_in [Range, Upload] arg to pass to primary_key_in scope
# @param primary_key_in [Range, Upload] arg to pass to primary_key_in scope
# @return [ActiveRecord::Relation<Upload>] everything that should be synced to this node, restricted by primary key
# @return [ActiveRecord::Relation<Upload>] everything that should be synced to this node, restricted by primary key
def
replicables_for_
geo_node
(
primary_key_in
)
def
replicables_for_
current_secondary
(
primary_key_in
)
node
=
::
Gitlab
::
Geo
.
current_node
node
=
::
Gitlab
::
Geo
.
current_node
primary_key_in
(
primary_key_in
)
primary_key_in
(
primary_key_in
)
...
...
ee/app/models/geo/base_registry.rb
View file @
82f5bb0e
...
@@ -53,7 +53,7 @@ class Geo::BaseRegistry < Geo::TrackingBase
...
@@ -53,7 +53,7 @@ class Geo::BaseRegistry < Geo::TrackingBase
model_primary_key
=
self
::
MODEL_CLASS
.
primary_key
.
to_sym
model_primary_key
=
self
::
MODEL_CLASS
.
primary_key
.
to_sym
source_ids
=
self
::
MODEL_CLASS
source_ids
=
self
::
MODEL_CLASS
.
replicables_for_
geo_node
(
range
)
.
replicables_for_
current_secondary
(
range
)
.
pluck
(
self
::
MODEL_CLASS
.
arel_table
[
model_primary_key
])
.
pluck
(
self
::
MODEL_CLASS
.
arel_table
[
model_primary_key
])
tracked_ids
=
self
.
pluck_model_ids_in_range
(
range
)
tracked_ids
=
self
.
pluck_model_ids_in_range
(
range
)
...
...
ee/app/models/geo/upload_registry.rb
View file @
82f5bb0e
...
@@ -34,7 +34,7 @@ class Geo::UploadRegistry < Geo::BaseRegistry
...
@@ -34,7 +34,7 @@ class Geo::UploadRegistry < Geo::BaseRegistry
# For example: [[[1, 'avatar'], [5, 'file']], [[3, 'attachment']]]
# For example: [[[1, 'avatar'], [5, 'file']], [[3, 'attachment']]]
def
self
.
find_registry_differences
(
range
)
def
self
.
find_registry_differences
(
range
)
source
=
source
=
self
::
MODEL_CLASS
.
replicables_for_
geo_node
(
range
)
self
::
MODEL_CLASS
.
replicables_for_
current_secondary
(
range
)
.
pluck
(
self
::
MODEL_CLASS
.
arel_table
[
:id
],
self
::
MODEL_CLASS
.
arel_table
[
:uploader
])
.
pluck
(
self
::
MODEL_CLASS
.
arel_table
[
:id
],
self
::
MODEL_CLASS
.
arel_table
[
:uploader
])
.
map!
{
|
id
,
uploader
|
[
id
,
uploader
.
sub
(
/Uploader\z/
,
''
).
underscore
]
}
.
map!
{
|
id
,
uploader
|
[
id
,
uploader
.
sub
(
/Uploader\z/
,
''
).
underscore
]
}
...
...
ee/lib/gitlab/geo/replicable_model.rb
View file @
82f5bb0e
...
@@ -83,8 +83,8 @@ module Gitlab
...
@@ -83,8 +83,8 @@ module Gitlab
end
end
end
end
def
in_replicables_for_
geo_node
?
def
in_replicables_for_
current_secondary
?
self
.
class
.
replicables_for_
geo_node
(
self
).
exists?
self
.
class
.
replicables_for_
current_secondary
(
self
).
exists?
end
end
end
end
end
end
...
...
ee/lib/gitlab/geo/replicator.rb
View file @
82f5bb0e
...
@@ -20,7 +20,7 @@ module Gitlab
...
@@ -20,7 +20,7 @@ module Gitlab
delegate
:model
,
to: :class
delegate
:model
,
to: :class
delegate
:replication_enabled_feature_key
,
to: :class
delegate
:replication_enabled_feature_key
,
to: :class
delegate
:in_replicables_for_
geo_node
?
,
to: :model_record
delegate
:in_replicables_for_
current_secondary
?
,
to: :model_record
class
<<
self
class
<<
self
delegate
:find_registries_never_attempted_sync
,
:find_registries_needs_sync_again
,
to: :registry_class
delegate
:find_registries_never_attempted_sync
,
:find_registries_needs_sync_again
,
to: :registry_class
...
...
ee/spec/lib/gitlab/geo/replicable_model_spec.rb
View file @
82f5bb0e
...
@@ -43,11 +43,11 @@ RSpec.describe Gitlab::Geo::ReplicableModel do
...
@@ -43,11 +43,11 @@ RSpec.describe Gitlab::Geo::ReplicableModel do
end
end
end
end
describe
'#in_replicables_for_
geo_node
?'
do
describe
'#in_replicables_for_
current_secondary
?'
do
it
'reuses replicables_for_
geo_node
'
do
it
'reuses replicables_for_
current_secondary
'
do
expect
(
DummyModel
).
to
receive
(
:replicables_for_
geo_node
).
once
.
with
(
subject
).
and_call_original
expect
(
DummyModel
).
to
receive
(
:replicables_for_
current_secondary
).
once
.
with
(
subject
).
and_call_original
subject
.
in_replicables_for_
geo_node
?
subject
.
in_replicables_for_
current_secondary
?
end
end
end
end
end
end
ee/spec/lib/gitlab/geo/replicator_spec.rb
View file @
82f5bb0e
...
@@ -171,7 +171,7 @@ RSpec.describe Gitlab::Geo::Replicator do
...
@@ -171,7 +171,7 @@ RSpec.describe Gitlab::Geo::Replicator do
end
end
end
end
describe
'#in_replicables_for_
geo_node
?'
do
describe
'#in_replicables_for_
current_secondary
?'
do
it
{
is_expected
.
to
delegate_method
(
:in_replicables_for_
geo_node
?
).
to
(
:model_record
)
}
it
{
is_expected
.
to
delegate_method
(
:in_replicables_for_
current_secondary
?
).
to
(
:model_record
)
}
end
end
end
end
ee/spec/models/ee/ci/job_artifact_spec.rb
View file @
82f5bb0e
...
@@ -133,7 +133,7 @@ RSpec.describe Ci::JobArtifact do
...
@@ -133,7 +133,7 @@ RSpec.describe Ci::JobArtifact do
end
end
end
end
describe
'#replicables_for_
geo_node
'
do
describe
'#replicables_for_
current_secondary
'
do
# Selective sync is configured relative to the job artifact's project.
# Selective sync is configured relative to the job artifact's project.
#
#
# Permutations of sync_object_storage combined with object-stored-artifacts
# Permutations of sync_object_storage combined with object-stored-artifacts
...
@@ -162,7 +162,7 @@ RSpec.describe Ci::JobArtifact do
...
@@ -162,7 +162,7 @@ RSpec.describe Ci::JobArtifact do
end
end
with_them
do
with_them
do
subject
(
:job_artifact_included
)
{
described_class
.
replicables_for_
geo_node
(
ci_job_artifact
).
exists?
}
subject
(
:job_artifact_included
)
{
described_class
.
replicables_for_
current_secondary
(
ci_job_artifact
).
exists?
}
let
(
:project
)
{
create
(
*
project_factory
)
}
let
(
:project
)
{
create
(
*
project_factory
)
}
let
(
:ci_build
)
{
create
(
:ci_build
,
project:
project
)
}
let
(
:ci_build
)
{
create
(
:ci_build
,
project:
project
)
}
...
...
ee/spec/models/ee/merge_request_diff_spec.rb
View file @
82f5bb0e
...
@@ -61,7 +61,7 @@ RSpec.describe MergeRequestDiff do
...
@@ -61,7 +61,7 @@ RSpec.describe MergeRequestDiff do
end
end
end
end
describe
'.replicables_for_
geo_node
'
do
describe
'.replicables_for_
current_secondary
'
do
context
'without selective sync or object storage'
do
context
'without selective sync or object storage'
do
let
(
:secondary
)
{
create
(
:geo_node
)
}
let
(
:secondary
)
{
create
(
:geo_node
)
}
...
@@ -74,13 +74,13 @@ RSpec.describe MergeRequestDiff do
...
@@ -74,13 +74,13 @@ RSpec.describe MergeRequestDiff do
create
(
:merge_request
,
source_project:
project
)
create
(
:merge_request
,
source_project:
project
)
expect
(
described_class
.
replicables_for_
geo_node
(
1
..
described_class
.
last
.
id
)).
to
be_empty
expect
(
described_class
.
replicables_for_
current_secondary
(
1
..
described_class
.
last
.
id
)).
to
be_empty
end
end
it
'excludes empty diffs'
do
it
'excludes empty diffs'
do
create
(
:merge_request
,
source_project:
create
(
:project
))
create
(
:merge_request
,
source_project:
create
(
:project
))
expect
(
described_class
.
replicables_for_
geo_node
(
1
..
described_class
.
last
.
id
)).
to
be_empty
expect
(
described_class
.
replicables_for_
current_secondary
(
1
..
described_class
.
last
.
id
)).
to
be_empty
end
end
end
end
...
@@ -119,7 +119,7 @@ RSpec.describe MergeRequestDiff do
...
@@ -119,7 +119,7 @@ RSpec.describe MergeRequestDiff do
end
end
it
'returns the proper number of merge request diff states'
do
it
'returns the proper number of merge request diff states'
do
expect
(
described_class
.
replicables_for_
geo_node
(
1
..
described_class
.
last
.
id
)).
to
have_attributes
(
count:
synced_states
)
expect
(
described_class
.
replicables_for_
current_secondary
(
1
..
described_class
.
last
.
id
)).
to
have_attributes
(
count:
synced_states
)
end
end
end
end
end
end
...
...
ee/spec/models/ee/terraform/state_version_spec.rb
View file @
82f5bb0e
...
@@ -25,7 +25,7 @@ RSpec.describe Terraform::StateVersion do
...
@@ -25,7 +25,7 @@ RSpec.describe Terraform::StateVersion do
end
end
end
end
describe
'.replicables_for_
geo_node
'
do
describe
'.replicables_for_
current_secondary
'
do
where
(
:selective_sync_enabled
,
:object_storage_sync_enabled
,
:terraform_object_storage_enabled
,
:synced_states
)
do
where
(
:selective_sync_enabled
,
:object_storage_sync_enabled
,
:terraform_object_storage_enabled
,
:synced_states
)
do
true
|
true
|
true
|
5
true
|
true
|
true
|
5
true
|
true
|
false
|
5
true
|
true
|
false
|
5
...
@@ -60,7 +60,7 @@ RSpec.describe Terraform::StateVersion do
...
@@ -60,7 +60,7 @@ RSpec.describe Terraform::StateVersion do
end
end
it
'returns the proper number of terraform states'
do
it
'returns the proper number of terraform states'
do
expect
(
described_class
.
replicables_for_
geo_node
(
1
..
described_class
.
last
.
id
).
count
).
to
eq
(
synced_states
)
expect
(
described_class
.
replicables_for_
current_secondary
(
1
..
described_class
.
last
.
id
).
count
).
to
eq
(
synced_states
)
end
end
end
end
end
end
...
...
ee/spec/models/packages/package_file_spec.rb
View file @
82f5bb0e
...
@@ -36,8 +36,8 @@ RSpec.describe Packages::PackageFile, type: :model do
...
@@ -36,8 +36,8 @@ RSpec.describe Packages::PackageFile, type: :model do
end
end
end
end
describe
'.replicables_for_
geo_node
'
do
describe
'.replicables_for_
current_secondary
'
do
subject
{
described_class
.
replicables_for_
geo_node
(
1
..
described_class
.
last
.
id
)
}
subject
{
described_class
.
replicables_for_
current_secondary
(
1
..
described_class
.
last
.
id
)
}
it
'returns a package files scope'
do
it
'returns a package files scope'
do
secondary
=
create
(
:geo_node
)
secondary
=
create
(
:geo_node
)
...
...
ee/spec/models/upload_spec.rb
View file @
82f5bb0e
...
@@ -6,7 +6,7 @@ RSpec.describe Upload do
...
@@ -6,7 +6,7 @@ RSpec.describe Upload do
include
EE
::
GeoHelpers
include
EE
::
GeoHelpers
using
RSpec
::
Parameterized
::
TableSyntax
using
RSpec
::
Parameterized
::
TableSyntax
describe
'.replicables_for_
geo_node
'
do
describe
'.replicables_for_
current_secondary
'
do
# Selective sync is configured relative to the upload's model. Take care not
# Selective sync is configured relative to the upload's model. Take care not
# to specify a model_factory that contradicts factory.
# to specify a model_factory that contradicts factory.
#
#
...
@@ -37,7 +37,7 @@ RSpec.describe Upload do
...
@@ -37,7 +37,7 @@ RSpec.describe Upload do
end
end
with_them
do
with_them
do
subject
(
:upload_included
)
{
described_class
.
replicables_for_
geo_node
(
upload
).
exists?
}
subject
(
:upload_included
)
{
described_class
.
replicables_for_
current_secondary
(
upload
).
exists?
}
let
(
:model
)
{
create
(
*
model_factory
)
}
let
(
:model
)
{
create
(
*
model_factory
)
}
let
(
:node
)
do
let
(
:node
)
do
...
...
ee/spec/support/helpers/ee/geo_helpers.rb
View file @
82f5bb0e
...
@@ -83,7 +83,7 @@ module EE
...
@@ -83,7 +83,7 @@ module EE
with_replicator
Geo
::
DummyReplicator
with_replicator
Geo
::
DummyReplicator
def
self
.
replicables_for_
geo_node
(
primary_key_in
)
def
self
.
replicables_for_
current_secondary
(
primary_key_in
)
self
.
primary_key_in
(
primary_key_in
)
self
.
primary_key_in
(
primary_key_in
)
end
end
end
end
...
...
ee/spec/support/shared_examples/models/concerns/blob_replicator_strategy_shared_examples.rb
View file @
82f5bb0e
...
@@ -109,7 +109,7 @@ RSpec.shared_examples 'a blob replicator' do
...
@@ -109,7 +109,7 @@ RSpec.shared_examples 'a blob replicator' do
describe
'created event consumption'
do
describe
'created event consumption'
do
context
"when the blob's project is in replicables for this geo node"
do
context
"when the blob's project is in replicables for this geo node"
do
it
'invokes Geo::BlobDownloadService'
do
it
'invokes Geo::BlobDownloadService'
do
expect
(
replicator
).
to
receive
(
:in_replicables_for_
geo_node
?
).
and_return
(
true
)
expect
(
replicator
).
to
receive
(
:in_replicables_for_
current_secondary
?
).
and_return
(
true
)
service
=
double
(
:service
)
service
=
double
(
:service
)
expect
(
service
).
to
receive
(
:execute
)
expect
(
service
).
to
receive
(
:execute
)
...
@@ -121,7 +121,7 @@ RSpec.shared_examples 'a blob replicator' do
...
@@ -121,7 +121,7 @@ RSpec.shared_examples 'a blob replicator' do
context
"when the blob's project is not in replicables for this geo node"
do
context
"when the blob's project is not in replicables for this geo node"
do
it
'does not invoke Geo::BlobDownloadService'
do
it
'does not invoke Geo::BlobDownloadService'
do
expect
(
replicator
).
to
receive
(
:in_replicables_for_
geo_node
?
).
and_return
(
false
)
expect
(
replicator
).
to
receive
(
:in_replicables_for_
current_secondary
?
).
and_return
(
false
)
expect
(
::
Geo
::
BlobDownloadService
).
not_to
receive
(
:new
)
expect
(
::
Geo
::
BlobDownloadService
).
not_to
receive
(
:new
)
...
...
ee/spec/support/shared_examples/models/concerns/replicable_model_shared_examples.rb
View file @
82f5bb0e
...
@@ -28,7 +28,7 @@ RSpec.shared_examples 'a replicable model' do
...
@@ -28,7 +28,7 @@ RSpec.shared_examples 'a replicable model' do
model_record
.
save!
model_record
.
save!
end
end
describe
'.replicables_for_
geo_node
'
do
describe
'.replicables_for_
current_secondary
'
do
let_it_be
(
:secondary
)
{
create
(
:geo_node
)
}
let_it_be
(
:secondary
)
{
create
(
:geo_node
)
}
before
do
before
do
...
@@ -36,7 +36,7 @@ RSpec.shared_examples 'a replicable model' do
...
@@ -36,7 +36,7 @@ RSpec.shared_examples 'a replicable model' do
end
end
it
'is implemented'
do
it
'is implemented'
do
expect
(
model_record
.
class
.
replicables_for_
geo_node
(
model_record
.
id
)).
to
be_an
(
ActiveRecord
::
Relation
)
expect
(
model_record
.
class
.
replicables_for_
current_secondary
(
model_record
.
id
)).
to
be_an
(
ActiveRecord
::
Relation
)
end
end
end
end
end
end
ee/spec/support/shared_examples/models/concerns/repository_replicator_strategy_shared_examples.rb
View file @
82f5bb0e
...
@@ -71,7 +71,7 @@ RSpec.shared_examples 'a repository replicator' do
...
@@ -71,7 +71,7 @@ RSpec.shared_examples 'a repository replicator' do
end
end
describe
'updated event consumption'
do
describe
'updated event consumption'
do
context
'in replicables_for_
geo_node
list'
do
context
'in replicables_for_
current_secondary
list'
do
it
'runs SnippetRepositorySyncService service'
do
it
'runs SnippetRepositorySyncService service'
do
model_record
.
save!
model_record
.
save!
...
@@ -87,7 +87,7 @@ RSpec.shared_examples 'a repository replicator' do
...
@@ -87,7 +87,7 @@ RSpec.shared_examples 'a repository replicator' do
end
end
end
end
context
'not in replicables_for_
geo_node
list'
do
context
'not in replicables_for_
current_secondary
list'
do
it
'runs SnippetRepositorySyncService service'
do
it
'runs SnippetRepositorySyncService service'
do
expect
(
::
Geo
::
FrameworkRepositorySyncService
)
expect
(
::
Geo
::
FrameworkRepositorySyncService
)
.
not_to
receive
(
:new
)
.
not_to
receive
(
:new
)
...
...
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