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
bd4f368d
Commit
bd4f368d
authored
Aug 24, 2020
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename count_syncable to registry_count
Rename this method make the finder class closer to a Geo replicator.
parent
b7bd7f5b
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
32 additions
and
32 deletions
+32
-32
ee/app/finders/geo/container_repository_registry_finder.rb
ee/app/finders/geo/container_repository_registry_finder.rb
+1
-1
ee/app/finders/geo/design_registry_finder.rb
ee/app/finders/geo/design_registry_finder.rb
+1
-1
ee/app/finders/geo/file_registry_finder.rb
ee/app/finders/geo/file_registry_finder.rb
+2
-2
ee/app/models/geo_node_status.rb
ee/app/models/geo_node_status.rb
+5
-5
ee/spec/finders/geo/attachment_registry_finder_spec.rb
ee/spec/finders/geo/attachment_registry_finder_spec.rb
+2
-2
ee/spec/finders/geo/container_repository_registry_finder_spec.rb
.../finders/geo/container_repository_registry_finder_spec.rb
+2
-2
ee/spec/finders/geo/design_registry_finder_spec.rb
ee/spec/finders/geo/design_registry_finder_spec.rb
+2
-2
ee/spec/finders/geo/job_artifact_registry_finder_spec.rb
ee/spec/finders/geo/job_artifact_registry_finder_spec.rb
+2
-2
ee/spec/finders/geo/lfs_object_registry_finder_spec.rb
ee/spec/finders/geo/lfs_object_registry_finder_spec.rb
+2
-2
ee/spec/models/geo_node_status_spec.rb
ee/spec/models/geo_node_status_spec.rb
+12
-12
ee/spec/support/shared_examples/finders/geo/file_registry_finders_shared_examples.rb
...ples/finders/geo/file_registry_finders_shared_examples.rb
+1
-1
No files found.
ee/app/finders/geo/container_repository_registry_finder.rb
View file @
bd4f368d
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
module
Geo
module
Geo
class
ContainerRepositoryRegistryFinder
<
RegistryFinder
class
ContainerRepositoryRegistryFinder
<
RegistryFinder
def
count_syncable
def
registry_count
container_repositories
.
count
container_repositories
.
count
end
end
...
...
ee/app/finders/geo/design_registry_finder.rb
View file @
bd4f368d
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
module
Geo
module
Geo
class
DesignRegistryFinder
<
RegistryFinder
class
DesignRegistryFinder
<
RegistryFinder
def
count_syncable
def
registry_count
designs
.
count
designs
.
count
end
end
...
...
ee/app/finders/geo/file_registry_finder.rb
View file @
bd4f368d
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
module
Geo
module
Geo
class
FileRegistryFinder
<
RegistryFinder
class
FileRegistryFinder
<
RegistryFinder
# @!method
count_syncable
# @!method
registry_count
# Return a count of the registry records for the tracked file_type(s)
# Return a count of the registry records for the tracked file_type(s)
def
count_syncable
def
registry_count
syncable
.
count
syncable
.
count
end
end
...
...
ee/app/models/geo_node_status.rb
View file @
bd4f368d
...
@@ -459,7 +459,7 @@ class GeoNodeStatus < ApplicationRecord
...
@@ -459,7 +459,7 @@ class GeoNodeStatus < ApplicationRecord
def
load_lfs_objects_data
def
load_lfs_objects_data
return
unless
lfs_objects_replication_enabled
return
unless
lfs_objects_replication_enabled
self
.
lfs_objects_count
=
lfs_objects_finder
.
count_syncable
self
.
lfs_objects_count
=
lfs_objects_finder
.
registry_count
self
.
lfs_objects_synced_count
=
lfs_objects_finder
.
count_synced
self
.
lfs_objects_synced_count
=
lfs_objects_finder
.
count_synced
self
.
lfs_objects_failed_count
=
lfs_objects_finder
.
count_failed
self
.
lfs_objects_failed_count
=
lfs_objects_finder
.
count_failed
self
.
lfs_objects_registry_count
=
lfs_objects_finder
.
count_registry
self
.
lfs_objects_registry_count
=
lfs_objects_finder
.
count_registry
...
@@ -469,7 +469,7 @@ class GeoNodeStatus < ApplicationRecord
...
@@ -469,7 +469,7 @@ class GeoNodeStatus < ApplicationRecord
def
load_job_artifacts_data
def
load_job_artifacts_data
return
unless
job_artifacts_replication_enabled
return
unless
job_artifacts_replication_enabled
self
.
job_artifacts_count
=
job_artifacts_finder
.
count_syncable
self
.
job_artifacts_count
=
job_artifacts_finder
.
registry_count
self
.
job_artifacts_synced_count
=
job_artifacts_finder
.
count_synced
self
.
job_artifacts_synced_count
=
job_artifacts_finder
.
count_synced
self
.
job_artifacts_failed_count
=
job_artifacts_finder
.
count_failed
self
.
job_artifacts_failed_count
=
job_artifacts_finder
.
count_failed
self
.
job_artifacts_registry_count
=
job_artifacts_finder
.
count_registry
self
.
job_artifacts_registry_count
=
job_artifacts_finder
.
count_registry
...
@@ -479,7 +479,7 @@ class GeoNodeStatus < ApplicationRecord
...
@@ -479,7 +479,7 @@ class GeoNodeStatus < ApplicationRecord
def
load_attachments_data
def
load_attachments_data
return
unless
attachments_replication_enabled
return
unless
attachments_replication_enabled
self
.
attachments_count
=
attachments_finder
.
count_syncable
self
.
attachments_count
=
attachments_finder
.
registry_count
self
.
attachments_synced_count
=
attachments_finder
.
count_synced
self
.
attachments_synced_count
=
attachments_finder
.
count_synced
self
.
attachments_failed_count
=
attachments_finder
.
count_failed
self
.
attachments_failed_count
=
attachments_finder
.
count_failed
self
.
attachments_registry_count
=
attachments_finder
.
count_registry
self
.
attachments_registry_count
=
attachments_finder
.
count_registry
...
@@ -489,7 +489,7 @@ class GeoNodeStatus < ApplicationRecord
...
@@ -489,7 +489,7 @@ class GeoNodeStatus < ApplicationRecord
def
load_container_registry_data
def
load_container_registry_data
return
unless
container_repositories_replication_enabled
return
unless
container_repositories_replication_enabled
self
.
container_repositories_count
=
container_registry_finder
.
count_syncable
self
.
container_repositories_count
=
container_registry_finder
.
registry_count
self
.
container_repositories_synced_count
=
container_registry_finder
.
count_synced
self
.
container_repositories_synced_count
=
container_registry_finder
.
count_synced
self
.
container_repositories_failed_count
=
container_registry_finder
.
count_failed
self
.
container_repositories_failed_count
=
container_registry_finder
.
count_failed
self
.
container_repositories_registry_count
=
container_registry_finder
.
count_registry
self
.
container_repositories_registry_count
=
container_registry_finder
.
count_registry
...
@@ -498,7 +498,7 @@ class GeoNodeStatus < ApplicationRecord
...
@@ -498,7 +498,7 @@ class GeoNodeStatus < ApplicationRecord
def
load_designs_data
def
load_designs_data
return
unless
design_repositories_replication_enabled
return
unless
design_repositories_replication_enabled
self
.
design_repositories_count
=
design_registry_finder
.
count_syncable
self
.
design_repositories_count
=
design_registry_finder
.
registry_count
self
.
design_repositories_synced_count
=
design_registry_finder
.
count_synced
self
.
design_repositories_synced_count
=
design_registry_finder
.
count_synced
self
.
design_repositories_failed_count
=
design_registry_finder
.
count_failed
self
.
design_repositories_failed_count
=
design_registry_finder
.
count_failed
self
.
design_repositories_registry_count
=
design_registry_finder
.
count_registry
self
.
design_repositories_registry_count
=
design_registry_finder
.
count_registry
...
...
ee/spec/finders/geo/attachment_registry_finder_spec.rb
View file @
bd4f368d
...
@@ -30,7 +30,7 @@ RSpec.describe Geo::AttachmentRegistryFinder, :geo do
...
@@ -30,7 +30,7 @@ RSpec.describe Geo::AttachmentRegistryFinder, :geo do
subject
{
described_class
.
new
(
current_node_id:
secondary
.
id
)
}
subject
{
described_class
.
new
(
current_node_id:
secondary
.
id
)
}
describe
'#
count_syncable
'
do
describe
'#
registry_count
'
do
it
'counts registries for uploads'
do
it
'counts registries for uploads'
do
create
(
:geo_upload_registry
,
:attachment
,
:failed
,
file_id:
upload_1
.
id
)
create
(
:geo_upload_registry
,
:attachment
,
:failed
,
file_id:
upload_1
.
id
)
create
(
:geo_upload_registry
,
:attachment
,
file_id:
upload_2
.
id
,
missing_on_primary:
true
)
create
(
:geo_upload_registry
,
:attachment
,
file_id:
upload_2
.
id
,
missing_on_primary:
true
)
...
@@ -41,7 +41,7 @@ RSpec.describe Geo::AttachmentRegistryFinder, :geo do
...
@@ -41,7 +41,7 @@ RSpec.describe Geo::AttachmentRegistryFinder, :geo do
create
(
:geo_upload_registry
,
:attachment
,
file_id:
upload_7
.
id
,
missing_on_primary:
true
)
create
(
:geo_upload_registry
,
:attachment
,
file_id:
upload_7
.
id
,
missing_on_primary:
true
)
create
(
:geo_upload_registry
,
:attachment
,
:never_synced
,
file_id:
upload_8
.
id
)
create
(
:geo_upload_registry
,
:attachment
,
:never_synced
,
file_id:
upload_8
.
id
)
expect
(
subject
.
count_syncable
).
to
eq
8
expect
(
subject
.
registry_count
).
to
eq
8
end
end
end
end
...
...
ee/spec/finders/geo/container_repository_registry_finder_spec.rb
View file @
bd4f368d
...
@@ -24,9 +24,9 @@ RSpec.describe Geo::ContainerRepositoryRegistryFinder, :geo do
...
@@ -24,9 +24,9 @@ RSpec.describe Geo::ContainerRepositoryRegistryFinder, :geo do
stub_registry_replication_config
(
enabled:
true
)
stub_registry_replication_config
(
enabled:
true
)
end
end
describe
'#
count_syncable
'
do
describe
'#
registry_count
'
do
it
'returns number of container repositories'
do
it
'returns number of container repositories'
do
expect
(
subject
.
count_syncable
).
to
eq
(
6
)
expect
(
subject
.
registry_count
).
to
eq
(
6
)
end
end
end
end
...
...
ee/spec/finders/geo/design_registry_finder_spec.rb
View file @
bd4f368d
...
@@ -21,13 +21,13 @@ RSpec.describe Geo::DesignRegistryFinder, :geo do
...
@@ -21,13 +21,13 @@ RSpec.describe Geo::DesignRegistryFinder, :geo do
stub_current_geo_node
(
secondary
)
stub_current_geo_node
(
secondary
)
end
end
describe
'#
count_syncable
'
do
describe
'#
registry_count
'
do
it
'returns number of designs'
do
it
'returns number of designs'
do
# Two designs for the same project to assert absence of duplicates
# Two designs for the same project to assert absence of duplicates
create_list
(
:design
,
2
,
project:
project_1
)
create_list
(
:design
,
2
,
project:
project_1
)
create
(
:design
,
project:
project_2
)
create
(
:design
,
project:
project_2
)
result
=
subject
.
count_syncable
result
=
subject
.
registry_count
expect
(
result
).
to
eq
(
2
)
expect
(
result
).
to
eq
(
2
)
end
end
...
...
ee/spec/finders/geo/job_artifact_registry_finder_spec.rb
View file @
bd4f368d
...
@@ -30,7 +30,7 @@ RSpec.describe Geo::JobArtifactRegistryFinder, :geo do
...
@@ -30,7 +30,7 @@ RSpec.describe Geo::JobArtifactRegistryFinder, :geo do
subject
{
described_class
.
new
(
current_node_id:
secondary
.
id
)
}
subject
{
described_class
.
new
(
current_node_id:
secondary
.
id
)
}
describe
'#
count_syncable
'
do
describe
'#
registry_count
'
do
it
'counts registries for job artifacts'
do
it
'counts registries for job artifacts'
do
create
(
:geo_job_artifact_registry
,
:failed
,
artifact_id:
ci_job_artifact_1
.
id
)
create
(
:geo_job_artifact_registry
,
:failed
,
artifact_id:
ci_job_artifact_1
.
id
)
create
(
:geo_job_artifact_registry
,
artifact_id:
ci_job_artifact_2
.
id
,
missing_on_primary:
true
)
create
(
:geo_job_artifact_registry
,
artifact_id:
ci_job_artifact_2
.
id
,
missing_on_primary:
true
)
...
@@ -41,7 +41,7 @@ RSpec.describe Geo::JobArtifactRegistryFinder, :geo do
...
@@ -41,7 +41,7 @@ RSpec.describe Geo::JobArtifactRegistryFinder, :geo do
create
(
:geo_job_artifact_registry
,
artifact_id:
ci_job_artifact_remote_2
.
id
,
missing_on_primary:
true
)
create
(
:geo_job_artifact_registry
,
artifact_id:
ci_job_artifact_remote_2
.
id
,
missing_on_primary:
true
)
create
(
:geo_job_artifact_registry
,
:never_synced
,
artifact_id:
ci_job_artifact_remote_3
.
id
)
create
(
:geo_job_artifact_registry
,
:never_synced
,
artifact_id:
ci_job_artifact_remote_3
.
id
)
expect
(
subject
.
count_syncable
).
to
eq
8
expect
(
subject
.
registry_count
).
to
eq
8
end
end
end
end
...
...
ee/spec/finders/geo/lfs_object_registry_finder_spec.rb
View file @
bd4f368d
...
@@ -20,7 +20,7 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo do
...
@@ -20,7 +20,7 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo do
subject
{
described_class
.
new
(
current_node_id:
secondary
.
id
)
}
subject
{
described_class
.
new
(
current_node_id:
secondary
.
id
)
}
describe
'#
count_syncable
'
do
describe
'#
registry_count
'
do
it
'counts registries for LFS objects'
do
it
'counts registries for LFS objects'
do
create
(
:geo_lfs_object_registry
,
:failed
,
lfs_object_id:
lfs_object_1
.
id
)
create
(
:geo_lfs_object_registry
,
:failed
,
lfs_object_id:
lfs_object_1
.
id
)
create
(
:geo_lfs_object_registry
,
lfs_object_id:
lfs_object_2
.
id
,
missing_on_primary:
true
)
create
(
:geo_lfs_object_registry
,
lfs_object_id:
lfs_object_2
.
id
,
missing_on_primary:
true
)
...
@@ -31,7 +31,7 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo do
...
@@ -31,7 +31,7 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo do
create
(
:geo_lfs_object_registry
,
lfs_object_id:
lfs_object_remote_2
.
id
,
missing_on_primary:
true
)
create
(
:geo_lfs_object_registry
,
lfs_object_id:
lfs_object_remote_2
.
id
,
missing_on_primary:
true
)
create
(
:geo_lfs_object_registry
,
:never_synced
,
lfs_object_id:
lfs_object_remote_3
.
id
)
create
(
:geo_lfs_object_registry
,
:never_synced
,
lfs_object_id:
lfs_object_remote_3
.
id
)
expect
(
subject
.
count_syncable
).
to
eq
8
expect
(
subject
.
registry_count
).
to
eq
8
end
end
end
end
...
...
ee/spec/models/geo_node_status_spec.rb
View file @
bd4f368d
...
@@ -1243,40 +1243,40 @@ RSpec.describe GeoNodeStatus, :geo do
...
@@ -1243,40 +1243,40 @@ RSpec.describe GeoNodeStatus, :geo do
stub_current_geo_node
(
primary
)
stub_current_geo_node
(
primary
)
end
end
it
'does not call LfsObjectRegistryFinder#
count_syncable
'
do
it
'does not call LfsObjectRegistryFinder#
registry_count
'
do
expect_any_instance_of
(
Geo
::
LfsObjectRegistryFinder
).
not_to
receive
(
:
count_syncable
)
expect_any_instance_of
(
Geo
::
LfsObjectRegistryFinder
).
not_to
receive
(
:
registry_count
)
subject
subject
end
end
it
'does not call AttachmentRegistryFinder#
count_syncable
'
do
it
'does not call AttachmentRegistryFinder#
registry_count
'
do
expect_any_instance_of
(
Geo
::
AttachmentRegistryFinder
).
not_to
receive
(
:
count_syncable
)
expect_any_instance_of
(
Geo
::
AttachmentRegistryFinder
).
not_to
receive
(
:
registry_count
)
subject
subject
end
end
it
'does not call JobArtifactRegistryFinder#
count_syncable
'
do
it
'does not call JobArtifactRegistryFinder#
registry_count
'
do
expect_any_instance_of
(
Geo
::
JobArtifactRegistryFinder
).
not_to
receive
(
:
count_syncable
)
expect_any_instance_of
(
Geo
::
JobArtifactRegistryFinder
).
not_to
receive
(
:
registry_count
)
subject
subject
end
end
end
end
context
'on the secondary'
do
context
'on the secondary'
do
it
'calls LfsObjectRegistryFinder#
count_syncable
'
do
it
'calls LfsObjectRegistryFinder#
registry_count
'
do
expect_any_instance_of
(
Geo
::
LfsObjectRegistryFinder
).
to
receive
(
:
count_syncable
)
expect_any_instance_of
(
Geo
::
LfsObjectRegistryFinder
).
to
receive
(
:
registry_count
)
subject
subject
end
end
it
'calls AttachmentRegistryFinder#
count_syncable
'
do
it
'calls AttachmentRegistryFinder#
registry_count
'
do
expect_any_instance_of
(
Geo
::
AttachmentRegistryFinder
).
to
receive
(
:
count_syncable
)
expect_any_instance_of
(
Geo
::
AttachmentRegistryFinder
).
to
receive
(
:
registry_count
)
subject
subject
end
end
it
'calls JobArtifactRegistryFinder#
count_syncable
'
do
it
'calls JobArtifactRegistryFinder#
registry_count
'
do
expect_any_instance_of
(
Geo
::
JobArtifactRegistryFinder
).
to
receive
(
:
count_syncable
)
expect_any_instance_of
(
Geo
::
JobArtifactRegistryFinder
).
to
receive
(
:
registry_count
)
subject
subject
end
end
...
...
ee/spec/support/shared_examples/finders/geo/file_registry_finders_shared_examples.rb
View file @
bd4f368d
...
@@ -4,7 +4,7 @@ RSpec.shared_examples 'a file registry finder' do
...
@@ -4,7 +4,7 @@ RSpec.shared_examples 'a file registry finder' do
it
'responds to file registry finder methods'
do
it
'responds to file registry finder methods'
do
file_registry_finder_methods
=
%i{
file_registry_finder_methods
=
%i{
syncable
syncable
count_syncable
registry_count
count_synced
count_synced
count_failed
count_failed
count_synced_missing_on_primary
count_synced_missing_on_primary
...
...
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