Rename count_syncable to registry_count

Rename this method make the finder class
closer to a Geo replicator.
parent b7bd7f5b
......@@ -2,7 +2,7 @@
module Geo
class ContainerRepositoryRegistryFinder < RegistryFinder
def count_syncable
def registry_count
container_repositories.count
end
......
......@@ -2,7 +2,7 @@
module Geo
class DesignRegistryFinder < RegistryFinder
def count_syncable
def registry_count
designs.count
end
......
......@@ -2,9 +2,9 @@
module Geo
class FileRegistryFinder < RegistryFinder
# @!method count_syncable
# @!method registry_count
# Return a count of the registry records for the tracked file_type(s)
def count_syncable
def registry_count
syncable.count
end
......
......@@ -459,7 +459,7 @@ class GeoNodeStatus < ApplicationRecord
def load_lfs_objects_data
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_failed_count = lfs_objects_finder.count_failed
self.lfs_objects_registry_count = lfs_objects_finder.count_registry
......@@ -469,7 +469,7 @@ class GeoNodeStatus < ApplicationRecord
def load_job_artifacts_data
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_failed_count = job_artifacts_finder.count_failed
self.job_artifacts_registry_count = job_artifacts_finder.count_registry
......@@ -479,7 +479,7 @@ class GeoNodeStatus < ApplicationRecord
def load_attachments_data
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_failed_count = attachments_finder.count_failed
self.attachments_registry_count = attachments_finder.count_registry
......@@ -489,7 +489,7 @@ class GeoNodeStatus < ApplicationRecord
def load_container_registry_data
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_failed_count = container_registry_finder.count_failed
self.container_repositories_registry_count = container_registry_finder.count_registry
......@@ -498,7 +498,7 @@ class GeoNodeStatus < ApplicationRecord
def load_designs_data
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_failed_count = design_registry_finder.count_failed
self.design_repositories_registry_count = design_registry_finder.count_registry
......
......@@ -30,7 +30,7 @@ RSpec.describe Geo::AttachmentRegistryFinder, :geo do
subject { described_class.new(current_node_id: secondary.id) }
describe '#count_syncable' do
describe '#registry_count' do
it 'counts registries for uploads' 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)
......@@ -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, :never_synced, file_id: upload_8.id)
expect(subject.count_syncable).to eq 8
expect(subject.registry_count).to eq 8
end
end
......
......@@ -24,9 +24,9 @@ RSpec.describe Geo::ContainerRepositoryRegistryFinder, :geo do
stub_registry_replication_config(enabled: true)
end
describe '#count_syncable' do
describe '#registry_count' do
it 'returns number of container repositories' do
expect(subject.count_syncable).to eq(6)
expect(subject.registry_count).to eq(6)
end
end
......
......@@ -21,13 +21,13 @@ RSpec.describe Geo::DesignRegistryFinder, :geo do
stub_current_geo_node(secondary)
end
describe '#count_syncable' do
describe '#registry_count' do
it 'returns number of designs' do
# Two designs for the same project to assert absence of duplicates
create_list(:design, 2, project: project_1)
create(:design, project: project_2)
result = subject.count_syncable
result = subject.registry_count
expect(result).to eq(2)
end
......
......@@ -30,7 +30,7 @@ RSpec.describe Geo::JobArtifactRegistryFinder, :geo do
subject { described_class.new(current_node_id: secondary.id) }
describe '#count_syncable' do
describe '#registry_count' 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, artifact_id: ci_job_artifact_2.id, missing_on_primary: true)
......@@ -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, :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
......
......@@ -20,7 +20,7 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo do
subject { described_class.new(current_node_id: secondary.id) }
describe '#count_syncable' do
describe '#registry_count' 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, lfs_object_id: lfs_object_2.id, missing_on_primary: true)
......@@ -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, :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
......
......@@ -1243,40 +1243,40 @@ RSpec.describe GeoNodeStatus, :geo do
stub_current_geo_node(primary)
end
it 'does not call LfsObjectRegistryFinder#count_syncable' do
expect_any_instance_of(Geo::LfsObjectRegistryFinder).not_to receive(:count_syncable)
it 'does not call LfsObjectRegistryFinder#registry_count' do
expect_any_instance_of(Geo::LfsObjectRegistryFinder).not_to receive(:registry_count)
subject
end
it 'does not call AttachmentRegistryFinder#count_syncable' do
expect_any_instance_of(Geo::AttachmentRegistryFinder).not_to receive(:count_syncable)
it 'does not call AttachmentRegistryFinder#registry_count' do
expect_any_instance_of(Geo::AttachmentRegistryFinder).not_to receive(:registry_count)
subject
end
it 'does not call JobArtifactRegistryFinder#count_syncable' do
expect_any_instance_of(Geo::JobArtifactRegistryFinder).not_to receive(:count_syncable)
it 'does not call JobArtifactRegistryFinder#registry_count' do
expect_any_instance_of(Geo::JobArtifactRegistryFinder).not_to receive(:registry_count)
subject
end
end
context 'on the secondary' do
it 'calls LfsObjectRegistryFinder#count_syncable' do
expect_any_instance_of(Geo::LfsObjectRegistryFinder).to receive(:count_syncable)
it 'calls LfsObjectRegistryFinder#registry_count' do
expect_any_instance_of(Geo::LfsObjectRegistryFinder).to receive(:registry_count)
subject
end
it 'calls AttachmentRegistryFinder#count_syncable' do
expect_any_instance_of(Geo::AttachmentRegistryFinder).to receive(:count_syncable)
it 'calls AttachmentRegistryFinder#registry_count' do
expect_any_instance_of(Geo::AttachmentRegistryFinder).to receive(:registry_count)
subject
end
it 'calls JobArtifactRegistryFinder#count_syncable' do
expect_any_instance_of(Geo::JobArtifactRegistryFinder).to receive(:count_syncable)
it 'calls JobArtifactRegistryFinder#registry_count' do
expect_any_instance_of(Geo::JobArtifactRegistryFinder).to receive(:registry_count)
subject
end
......
......@@ -4,7 +4,7 @@ RSpec.shared_examples 'a file registry finder' do
it 'responds to file registry finder methods' do
file_registry_finder_methods = %i{
syncable
count_syncable
registry_count
count_synced
count_failed
count_synced_missing_on_primary
......
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