Rename count_failed to failed_count

Rename this method make the finder class
closer to a Geo replicator.
parent 22224c63
......@@ -67,10 +67,10 @@ module Geo
registry_class.synced.count
end
# @!method count_failed
# @!method failed_count
# Return a count of the registry records for the tracked type
# that are sync failed
def count_failed
def failed_count
registry_class.failed.count
end
......
......@@ -461,7 +461,7 @@ class GeoNodeStatus < ApplicationRecord
self.lfs_objects_count = lfs_objects_finder.registry_count
self.lfs_objects_synced_count = lfs_objects_finder.synced_count
self.lfs_objects_failed_count = lfs_objects_finder.count_failed
self.lfs_objects_failed_count = lfs_objects_finder.failed_count
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
end
......@@ -471,7 +471,7 @@ class GeoNodeStatus < ApplicationRecord
self.job_artifacts_count = job_artifacts_finder.registry_count
self.job_artifacts_synced_count = job_artifacts_finder.synced_count
self.job_artifacts_failed_count = job_artifacts_finder.count_failed
self.job_artifacts_failed_count = job_artifacts_finder.failed_count
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
end
......@@ -481,7 +481,7 @@ class GeoNodeStatus < ApplicationRecord
self.attachments_count = attachments_finder.registry_count
self.attachments_synced_count = attachments_finder.synced_count
self.attachments_failed_count = attachments_finder.count_failed
self.attachments_failed_count = attachments_finder.failed_count
self.attachments_registry_count = attachments_finder.count_registry
self.attachments_synced_missing_on_primary_count = attachments_finder.count_synced_missing_on_primary
end
......@@ -491,7 +491,7 @@ class GeoNodeStatus < ApplicationRecord
self.container_repositories_count = container_registry_finder.registry_count
self.container_repositories_synced_count = container_registry_finder.synced_count
self.container_repositories_failed_count = container_registry_finder.count_failed
self.container_repositories_failed_count = container_registry_finder.failed_count
self.container_repositories_registry_count = container_registry_finder.count_registry
end
......@@ -500,7 +500,7 @@ class GeoNodeStatus < ApplicationRecord
self.design_repositories_count = design_registry_finder.registry_count
self.design_repositories_synced_count = design_registry_finder.synced_count
self.design_repositories_failed_count = design_registry_finder.count_failed
self.design_repositories_failed_count = design_registry_finder.failed_count
self.design_repositories_registry_count = design_registry_finder.count_registry
end
......
......@@ -75,7 +75,7 @@ RSpec.describe Geo::AttachmentRegistryFinder, :geo do
end
end
describe '#count_failed' do
describe '#failed_count' do
it 'counts registries that sync has failed' 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)
......@@ -86,7 +86,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_failed).to eq 3
expect(subject.failed_count).to eq 3
end
end
......@@ -101,7 +101,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_missing_on_primary).to eq 3
expect(subject.synced_count_missing_on_primary).to eq 3
end
end
......
......@@ -39,12 +39,12 @@ RSpec.describe Geo::ContainerRepositoryRegistryFinder, :geo do
end
end
describe '#count_failed' do
describe '#failed_count' do
it 'returns only failed 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_failed).to eq(1)
expect(subject.failed_count).to eq(1)
end
end
......
......@@ -42,12 +42,12 @@ RSpec.describe Geo::DesignRegistryFinder, :geo do
end
end
describe '#count_failed' do
describe '#failed_count' do
it 'returns number of failed 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_failed).to eq(1)
expect(subject.failed_count).to eq(1)
end
end
......
......@@ -75,7 +75,7 @@ RSpec.describe Geo::JobArtifactRegistryFinder, :geo do
end
end
describe '#count_failed' do
describe '#failed_count' do
it 'counts registries that sync has failed' 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)
......@@ -86,7 +86,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_failed).to eq 3
expect(subject.failed_count).to eq 3
end
end
......
......@@ -65,7 +65,7 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo do
end
end
describe '#count_failed' do
describe '#failed_count' do
it 'counts registries that sync has failed' 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)
......@@ -76,7 +76,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_failed).to eq 3
expect(subject.failed_count).to eq 3
end
end
......
......@@ -6,7 +6,7 @@ RSpec.shared_examples 'a file registry finder' do
registry_class
registry_count
synced_count
count_failed
failed_count
count_synced_missing_on_primary
count_registry
find_retryable_failed_registries
......
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