Rename count_synced to synced_count

Rename this method make the finder class
closer to a Geo replicator.
parent 1f1bec52
......@@ -60,10 +60,10 @@ module Geo
end
alias_method :count_registry, :registry_count
# @!method count_synced
# @!method synced_count
# Return a count of the registry records for the tracked type
# that are synced
def count_synced
def synced_count
registry_class.synced.count
end
......
......@@ -460,7 +460,7 @@ class GeoNodeStatus < ApplicationRecord
return unless lfs_objects_replication_enabled
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.synced_count
self.lfs_objects_failed_count = lfs_objects_finder.count_failed
self.lfs_objects_registry_count = lfs_objects_finder.count_registry
self.lfs_objects_synced_missing_on_primary_count = lfs_objects_finder.count_synced_missing_on_primary
......@@ -470,7 +470,7 @@ class GeoNodeStatus < ApplicationRecord
return unless job_artifacts_replication_enabled
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.synced_count
self.job_artifacts_failed_count = job_artifacts_finder.count_failed
self.job_artifacts_registry_count = job_artifacts_finder.count_registry
self.job_artifacts_synced_missing_on_primary_count = job_artifacts_finder.count_synced_missing_on_primary
......@@ -480,7 +480,7 @@ class GeoNodeStatus < ApplicationRecord
return unless attachments_replication_enabled
self.attachments_count = attachments_finder.registry_count
self.attachments_synced_count = attachments_finder.count_synced
self.attachments_synced_count = attachments_finder.synced_count
self.attachments_failed_count = attachments_finder.count_failed
self.attachments_registry_count = attachments_finder.count_registry
self.attachments_synced_missing_on_primary_count = attachments_finder.count_synced_missing_on_primary
......@@ -490,7 +490,7 @@ class GeoNodeStatus < ApplicationRecord
return unless container_repositories_replication_enabled
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.synced_count
self.container_repositories_failed_count = container_registry_finder.count_failed
self.container_repositories_registry_count = container_registry_finder.count_registry
end
......@@ -499,7 +499,7 @@ class GeoNodeStatus < ApplicationRecord
return unless design_repositories_replication_enabled
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.synced_count
self.design_repositories_failed_count = design_registry_finder.count_failed
self.design_repositories_registry_count = design_registry_finder.count_registry
end
......
......@@ -60,7 +60,7 @@ RSpec.describe Geo::AttachmentRegistryFinder, :geo do
end
end
describe '#count_synced' do
describe '#synced_count' do
it 'counts registries that has been synced' do
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)
......@@ -71,7 +71,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, :never_synced, file_id: upload_8.id)
expect(subject.count_synced).to eq 3
expect(subject.synced_count).to eq 3
end
end
......
......@@ -30,12 +30,12 @@ RSpec.describe Geo::ContainerRepositoryRegistryFinder, :geo do
end
end
describe '#count_synced' do
describe '#synced_count' do
it 'returns only synced registry' do
create(:container_repository_registry, :synced, container_repository_id: container_repository_1.id)
create(:container_repository_registry, :sync_failed, container_repository_id: container_repository_3.id)
expect(subject.count_synced).to eq(1)
expect(subject.synced_count).to eq(1)
end
end
......
......@@ -33,12 +33,12 @@ RSpec.describe Geo::DesignRegistryFinder, :geo do
end
end
describe '#count_synced' do
describe '#synced_count' do
it 'returns number of synced registries' do
create(:geo_design_registry, :synced, project_id: project_1.id)
create(:geo_design_registry, :sync_failed, project_id: project_2.id)
expect(subject.count_synced).to eq(1)
expect(subject.synced_count).to eq(1)
end
end
......
......@@ -60,7 +60,7 @@ RSpec.describe Geo::JobArtifactRegistryFinder, :geo do
end
end
describe '#count_synced' do
describe '#synced_count' do
it 'counts registries that has been synced' do
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)
......@@ -71,7 +71,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, :never_synced, artifact_id: ci_job_artifact_remote_3.id)
expect(subject.count_synced).to eq 3
expect(subject.synced_count).to eq 3
end
end
......
......@@ -50,7 +50,7 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo do
end
end
describe '#count_synced' do
describe '#synced_count' do
it 'counts registries that has been synced' do
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)
......@@ -61,7 +61,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, :never_synced, lfs_object_id: lfs_object_remote_3.id)
expect(subject.count_synced).to eq 3
expect(subject.synced_count).to eq 3
end
end
......
......@@ -5,7 +5,7 @@ RSpec.shared_examples 'a file registry finder' do
file_registry_finder_methods = %i{
registry_class
registry_count
count_synced
synced_count
count_failed
count_synced_missing_on_primary
count_registry
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment