Commit f50defb4 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre Committed by Ash McKenzie

Does not apply selective sync restrictions while counting job artifacts

parent 276b063d
...@@ -19,7 +19,7 @@ module Geo ...@@ -19,7 +19,7 @@ module Geo
end end
def count_registry def count_registry
registries_for_attachments.count Geo::FileRegistry.attachments.count
end end
def syncable def syncable
......
...@@ -19,7 +19,7 @@ module Geo ...@@ -19,7 +19,7 @@ module Geo
end end
def count_registry def count_registry
registries_for_job_artifacts.count Geo::JobArtifactRegistry.count
end end
def syncable def syncable
......
...@@ -19,7 +19,7 @@ module Geo ...@@ -19,7 +19,7 @@ module Geo
end end
def count_registry def count_registry
registries_for_lfs_objects.count Geo::FileRegistry.lfs_objects.count
end end
def syncable def syncable
......
...@@ -427,14 +427,14 @@ describe Geo::AttachmentRegistryFinder, :geo do ...@@ -427,14 +427,14 @@ describe Geo::AttachmentRegistryFinder, :geo do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [synced_group]) secondary.update!(selective_sync_type: 'namespaces', namespaces: [synced_group])
end end
it 'counts file registries for attachments' do it 'does not apply the selective sync restriction' do
create(:geo_file_registry, :attachment, :failed, file_id: upload_1.id, missing_on_primary: true) create(:geo_file_registry, :attachment, :failed, file_id: upload_1.id, missing_on_primary: true)
create(:geo_file_registry, :attachment, file_id: upload_2.id) create(:geo_file_registry, :attachment, file_id: upload_2.id)
create(:geo_file_registry, :attachment, file_id: upload_3.id) create(:geo_file_registry, :attachment, file_id: upload_3.id)
create(:geo_file_registry, :attachment, file_id: upload_4.id) create(:geo_file_registry, :attachment, file_id: upload_4.id)
create(:geo_file_registry, :attachment, file_id: upload_5.id, missing_on_primary: true) create(:geo_file_registry, :attachment, file_id: upload_5.id, missing_on_primary: true)
expect(subject.count_registry).to eq 3 expect(subject.count_registry).to eq 5
end end
end end
...@@ -443,14 +443,14 @@ describe Geo::AttachmentRegistryFinder, :geo do ...@@ -443,14 +443,14 @@ describe Geo::AttachmentRegistryFinder, :geo do
secondary.update!(selective_sync_type: 'shards', selective_sync_shards: ['broken']) secondary.update!(selective_sync_type: 'shards', selective_sync_shards: ['broken'])
end end
it 'counts file registries for attachments' do it 'does not apply the selective sync restriction' do
create(:geo_file_registry, :attachment, :failed, file_id: upload_1.id) create(:geo_file_registry, :attachment, :failed, file_id: upload_1.id)
create(:geo_file_registry, :attachment, file_id: upload_2.id, missing_on_primary: true) create(:geo_file_registry, :attachment, file_id: upload_2.id, missing_on_primary: true)
create(:geo_file_registry, :attachment, file_id: upload_3.id) create(:geo_file_registry, :attachment, file_id: upload_3.id)
create(:geo_file_registry, :attachment, file_id: upload_4.id) create(:geo_file_registry, :attachment, file_id: upload_4.id)
create(:geo_file_registry, :attachment, file_id: upload_5.id) create(:geo_file_registry, :attachment, file_id: upload_5.id)
expect(subject.count_registry).to eq 3 expect(subject.count_registry).to eq 5
end end
end end
end end
......
...@@ -382,8 +382,8 @@ describe Geo::JobArtifactRegistryFinder, :geo do ...@@ -382,8 +382,8 @@ describe Geo::JobArtifactRegistryFinder, :geo do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [synced_group]) secondary.update!(selective_sync_type: 'namespaces', namespaces: [synced_group])
end end
it 'counts file registries for job artifacts' do it 'does not apply the selective sync restriction' do
expect(subject.count_registry).to eq 2 expect(subject.count_registry).to eq 4
end end
end end
...@@ -392,8 +392,8 @@ describe Geo::JobArtifactRegistryFinder, :geo do ...@@ -392,8 +392,8 @@ describe Geo::JobArtifactRegistryFinder, :geo do
secondary.update!(selective_sync_type: 'shards', selective_sync_shards: ['broken']) secondary.update!(selective_sync_type: 'shards', selective_sync_shards: ['broken'])
end end
it 'counts file registries for job artifacts' do it 'does not apply the selective sync restriction' do
expect(subject.count_registry).to eq 1 expect(subject.count_registry).to eq 4
end end
end end
end end
......
...@@ -107,13 +107,13 @@ describe Geo::LfsObjectRegistryFinder, :geo do ...@@ -107,13 +107,13 @@ describe Geo::LfsObjectRegistryFinder, :geo do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [synced_group]) secondary.update!(selective_sync_type: 'namespaces', namespaces: [synced_group])
end end
it 'counts file registries for LFS objects' do it 'does not apply the selective sync restriction' do
create(:geo_file_registry, :lfs, file_id: lfs_object_remote_1.id) create(:geo_file_registry, :lfs, file_id: lfs_object_remote_1.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id) create(:geo_file_registry, :lfs, file_id: lfs_object_2.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_3.id) create(:geo_file_registry, :lfs, file_id: lfs_object_3.id)
create(:geo_file_registry, :avatar) create(:geo_file_registry, :avatar)
expect(subject.count_registry).to eq 1 expect(subject.count_registry).to eq 3
end end
end end
...@@ -130,13 +130,13 @@ describe Geo::LfsObjectRegistryFinder, :geo do ...@@ -130,13 +130,13 @@ describe Geo::LfsObjectRegistryFinder, :geo do
secondary.update!(selective_sync_type: 'shards', selective_sync_shards: ['broken']) secondary.update!(selective_sync_type: 'shards', selective_sync_shards: ['broken'])
end end
it 'counts file registries for LFS objects' do it 'does not apply the selective sync restriction' do
create(:geo_file_registry, :lfs, file_id: lfs_object_remote_1.id) create(:geo_file_registry, :lfs, file_id: lfs_object_remote_1.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id) create(:geo_file_registry, :lfs, file_id: lfs_object_2.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_4.id) create(:geo_file_registry, :lfs, file_id: lfs_object_4.id)
create(:geo_file_registry, :avatar) create(:geo_file_registry, :avatar)
expect(subject.count_registry).to eq 2 expect(subject.count_registry).to eq 3
end end
end end
end end
......
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