Remove feature flag for projects on Geo node status

Since GitLab 13.2 we don't rely on FDW queries
to sync/verify these repositories.
parent 9e88c808
...@@ -450,17 +450,10 @@ class GeoNodeStatus < ApplicationRecord ...@@ -450,17 +450,10 @@ class GeoNodeStatus < ApplicationRecord
end end
def load_repositories_data def load_repositories_data
if Geo::ProjectRegistry.registry_consistency_worker_enabled?
self.repositories_synced_count = Geo::ProjectRegistry.synced(:repository).count self.repositories_synced_count = Geo::ProjectRegistry.synced(:repository).count
self.repositories_failed_count = Geo::ProjectRegistry.sync_failed(:repository).count self.repositories_failed_count = Geo::ProjectRegistry.sync_failed(:repository).count
self.wikis_synced_count = Geo::ProjectRegistry.synced(:wiki).count self.wikis_synced_count = Geo::ProjectRegistry.synced(:wiki).count
self.wikis_failed_count = Geo::ProjectRegistry.sync_failed(:wiki).count self.wikis_failed_count = Geo::ProjectRegistry.sync_failed(:wiki).count
else
self.repositories_synced_count = registries_for_synced_projects(:repository).count
self.repositories_failed_count = registries_for_failed_projects(:repository).count
self.wikis_synced_count = registries_for_synced_projects(:wiki).count
self.wikis_failed_count = registries_for_failed_projects(:wiki).count
end
end end
def load_lfs_objects_data def load_lfs_objects_data
...@@ -549,7 +542,6 @@ class GeoNodeStatus < ApplicationRecord ...@@ -549,7 +542,6 @@ class GeoNodeStatus < ApplicationRecord
end end
def load_secondary_verification_data def load_secondary_verification_data
if Geo::ProjectRegistry.registry_consistency_worker_enabled?
self.repositories_verified_count = Geo::ProjectRegistry.verified(:repository).count self.repositories_verified_count = Geo::ProjectRegistry.verified(:repository).count
self.repositories_verification_failed_count = Geo::ProjectRegistry.verification_failed(:repository).count self.repositories_verification_failed_count = Geo::ProjectRegistry.verification_failed(:repository).count
self.repositories_checksum_mismatch_count = Geo::ProjectRegistry.mismatch(:repository).count self.repositories_checksum_mismatch_count = Geo::ProjectRegistry.mismatch(:repository).count
...@@ -558,16 +550,6 @@ class GeoNodeStatus < ApplicationRecord ...@@ -558,16 +550,6 @@ class GeoNodeStatus < ApplicationRecord
self.wikis_checksum_mismatch_count = Geo::ProjectRegistry.mismatch(:wiki).count self.wikis_checksum_mismatch_count = Geo::ProjectRegistry.mismatch(:wiki).count
self.repositories_retrying_verification_count = Geo::ProjectRegistry.retrying_verification(:repository).count self.repositories_retrying_verification_count = Geo::ProjectRegistry.retrying_verification(:repository).count
self.wikis_retrying_verification_count = Geo::ProjectRegistry.retrying_verification(:wiki).count self.wikis_retrying_verification_count = Geo::ProjectRegistry.retrying_verification(:wiki).count
else
self.repositories_verified_count = registries_for_verified_projects(:repository).count
self.repositories_verification_failed_count = registries_for_verification_failed_projects(:repository).count
self.repositories_checksum_mismatch_count = registries_for_mismatch_projects(:repository).count
self.wikis_verified_count = registries_for_verified_projects(:wiki).count
self.wikis_verification_failed_count = registries_for_verification_failed_projects(:wiki).count
self.wikis_checksum_mismatch_count = registries_for_mismatch_projects(:wiki).count
self.repositories_retrying_verification_count = registries_retrying_verification(:repository).count
self.wikis_retrying_verification_count = registries_retrying_verification(:wiki).count
end
end end
def primary_storage_digest def primary_storage_digest
...@@ -594,42 +576,6 @@ class GeoNodeStatus < ApplicationRecord ...@@ -594,42 +576,6 @@ class GeoNodeStatus < ApplicationRecord
@design_registry_finder ||= Geo::DesignRegistryFinder.new(current_node_id: geo_node.id) @design_registry_finder ||= Geo::DesignRegistryFinder.new(current_node_id: geo_node.id)
end end
def registries_for_synced_projects(type)
Geo::ProjectRegistrySyncedFinder
.new(current_node: geo_node, type: type)
.execute
end
def registries_for_failed_projects(type)
Geo::ProjectRegistrySyncFailedFinder
.new(current_node: geo_node, type: type)
.execute
end
def registries_for_verified_projects(type)
Geo::ProjectRegistryVerifiedFinder
.new(current_node: geo_node, type: type)
.execute
end
def registries_for_verification_failed_projects(type)
Geo::ProjectRegistryVerificationFailedFinder
.new(current_node: geo_node, type: type)
.execute
end
def registries_for_mismatch_projects(type)
Geo::ProjectRegistryMismatchFinder
.new(current_node: geo_node, type: type)
.execute
end
def registries_retrying_verification(type)
Geo::ProjectRegistryRetryingVerificationFinder
.new(current_node: geo_node, type: type)
.execute
end
def repository_verification_finder def repository_verification_finder
@repository_verification_finder ||= Geo::RepositoryVerificationFinder.new @repository_verification_finder ||= Geo::RepositoryVerificationFinder.new
end end
......
...@@ -320,145 +320,49 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do ...@@ -320,145 +320,49 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do
end end
describe '#repositories_synced_count' do describe '#repositories_synced_count' do
before do it 'returns the right number of synced registries' do
create(:geo_project_registry, :synced, project: project_1) create(:geo_project_registry, :synced, project: project_1)
create(:geo_project_registry, :synced, project: project_3) create(:geo_project_registry, :synced, project: project_3)
create(:geo_project_registry, :repository_syncing, project: project_4) create(:geo_project_registry, :repository_syncing, project: project_4)
create(:geo_project_registry, :wiki_syncing) create(:geo_project_registry, :wiki_syncing)
end
context 'when geo_project_registry_ssot_sync is enabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: true)
end
it 'returns the right number of synced registries' do
expect(subject.repositories_synced_count).to eq(3) expect(subject.repositories_synced_count).to eq(3)
end end
end end
context 'when geo_project_registry_ssot_sync is disabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: false)
end
it 'returns the right number of synced repositories with no group restrictions' do
expect(subject.repositories_synced_count).to eq(3)
end
it 'returns the right number of synced repositories with group restrictions' do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [group])
expect(subject.repositories_synced_count).to eq(1)
end
end
end
describe '#wikis_synced_count' do describe '#wikis_synced_count' do
before do it 'returns the right number of synced registries' do
create(:geo_project_registry, :synced, project: project_1) create(:geo_project_registry, :synced, project: project_1)
create(:geo_project_registry, :synced, project: project_3) create(:geo_project_registry, :synced, project: project_3)
create(:geo_project_registry, :repository_syncing, project: project_4) create(:geo_project_registry, :repository_syncing, project: project_4)
create(:geo_project_registry, :wiki_syncing) create(:geo_project_registry, :wiki_syncing)
end
context 'when geo_project_registry_ssot_sync is enabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: true)
end
it 'returns the right number of synced registries' do
expect(subject.wikis_synced_count).to eq(3) expect(subject.wikis_synced_count).to eq(3)
end end
end end
context 'when geo_project_registry_ssot_sync is disabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: false)
end
it 'returns the right number of synced repositories with no group restrictions' do
expect(subject.wikis_synced_count).to eq(3)
end
it 'returns the right number of synced repositories with group restrictions' do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [group])
expect(subject.wikis_synced_count).to eq(1)
end
end
end
describe '#repositories_failed_count' do describe '#repositories_failed_count' do
before do it 'returns the right number of failed registries' do
create(:geo_project_registry, :sync_failed, project: project_1) create(:geo_project_registry, :sync_failed, project: project_1)
create(:geo_project_registry, :sync_failed, project: project_3) create(:geo_project_registry, :sync_failed, project: project_3)
create(:geo_project_registry, :repository_syncing, project: project_4) create(:geo_project_registry, :repository_syncing, project: project_4)
create(:geo_project_registry, :wiki_syncing) create(:geo_project_registry, :wiki_syncing)
end
context 'when geo_project_registry_ssot_sync is enabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: true)
end
it 'returns the right number of failed registries' do
expect(subject.repositories_failed_count).to eq(2)
end
end
context 'when geo_project_registry_ssot_sync is disabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: false)
end
it 'returns the right number of failed repos with no group restrictions' do
expect(subject.repositories_failed_count).to eq(2) expect(subject.repositories_failed_count).to eq(2)
end end
it 'returns the right number of failed repos with group restrictions' do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [group])
expect(subject.repositories_failed_count).to eq(1)
end
end
end end
describe '#wikis_failed_count' do describe '#wikis_failed_count' do
before do it 'returns the right number of failed registries' do
create(:geo_project_registry, :sync_failed, project: project_1) create(:geo_project_registry, :sync_failed, project: project_1)
create(:geo_project_registry, :sync_failed, project: project_3) create(:geo_project_registry, :sync_failed, project: project_3)
create(:geo_project_registry, :repository_syncing, project: project_4) create(:geo_project_registry, :repository_syncing, project: project_4)
create(:geo_project_registry, :wiki_syncing) create(:geo_project_registry, :wiki_syncing)
end
context 'when geo_project_registry_ssot_sync is enabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: true)
end
it 'returns the right number of failed registries' do
expect(subject.wikis_failed_count).to eq(2) expect(subject.wikis_failed_count).to eq(2)
end end
end end
context 'when geo_project_registry_ssot_sync is disabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: false)
end
it 'returns the right number of failed repositoriess with no group restrictions' do
expect(subject.wikis_failed_count).to eq(2)
end
it 'returns the right number of failed repositoriess with group restrictions' do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [group])
expect(subject.wikis_failed_count).to eq(1)
end
end
end
describe '#repositories_synced_in_percentage' do describe '#repositories_synced_in_percentage' do
it 'returns 0 when no projects are available' do it 'returns 0 when no projects are available' do
expect(subject.repositories_synced_in_percentage).to eq(0) expect(subject.repositories_synced_in_percentage).to eq(0)
...@@ -882,38 +786,16 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do ...@@ -882,38 +786,16 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do
describe '#repositories_verified_count' do describe '#repositories_verified_count' do
before do before do
stub_current_geo_node(secondary) stub_current_geo_node(secondary)
end
it 'returns the right number of verified registries' do
create(:geo_project_registry, :repository_verified, project: project_1) create(:geo_project_registry, :repository_verified, project: project_1)
create(:geo_project_registry, :repository_verified, :repository_checksum_mismatch, project: project_3) create(:geo_project_registry, :repository_verified, :repository_checksum_mismatch, project: project_3)
create(:geo_project_registry, :repository_verification_failed) create(:geo_project_registry, :repository_verification_failed)
create(:geo_project_registry, :wiki_verified, project: project_4) create(:geo_project_registry, :wiki_verified, project: project_4)
end
context 'when geo_project_registry_ssot_sync is enabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: true)
end
it 'returns the right number of verified registries' do
expect(subject.repositories_verified_count).to eq(2) expect(subject.repositories_verified_count).to eq(2)
end end
end
context 'when geo_project_registry_ssot_sync is disabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: false)
end
it 'returns the right number of verified repositories with no group restrictions' do
expect(subject.repositories_verified_count).to eq(2)
end
it 'returns the right number of verified repositories with group restrictions' do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [group])
expect(subject.repositories_verified_count).to eq(1)
end
end
it 'returns existing value when feature flag if off' do it 'returns existing value when feature flag if off' do
allow(Gitlab::Geo).to receive(:repository_verification_enabled?).and_return(false) allow(Gitlab::Geo).to receive(:repository_verification_enabled?).and_return(false)
...@@ -926,39 +808,17 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do ...@@ -926,39 +808,17 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do
describe '#repositories_checksum_mismatch_count' do describe '#repositories_checksum_mismatch_count' do
before do before do
stub_current_geo_node(secondary) stub_current_geo_node(secondary)
end
it 'returns the right number of registries that checksum mismatch' do
create(:geo_project_registry, :repository_checksum_mismatch, project: project_1) create(:geo_project_registry, :repository_checksum_mismatch, project: project_1)
create(:geo_project_registry, :repository_checksum_mismatch, project: project_3) create(:geo_project_registry, :repository_checksum_mismatch, project: project_3)
create(:geo_project_registry, :repository_verified) create(:geo_project_registry, :repository_verified)
create(:geo_project_registry, :wiki_checksum_mismatch, project: project_4) create(:geo_project_registry, :wiki_checksum_mismatch, project: project_4)
end
context 'when geo_project_registry_ssot_sync is enabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: true)
end
it 'returns the right number of registries that checksum mismatch' do
expect(subject.repositories_checksum_mismatch_count).to eq(2)
end
end
context 'when geo_project_registry_ssot_sync is disabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: false)
end
it 'returns the right number of repositories that checksum mismatch with no group restrictions' do
expect(subject.repositories_checksum_mismatch_count).to eq(2) expect(subject.repositories_checksum_mismatch_count).to eq(2)
end end
it 'returns the right number of repositories that checksum mismatch with group restrictions' do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [group])
expect(subject.repositories_checksum_mismatch_count).to eq(1)
end
end
it 'returns existing value when feature flag if off' do it 'returns existing value when feature flag if off' do
allow(Gitlab::Geo).to receive(:repository_verification_enabled?).and_return(false) allow(Gitlab::Geo).to receive(:repository_verification_enabled?).and_return(false)
create(:geo_node_status, :healthy, geo_node: secondary) create(:geo_node_status, :healthy, geo_node: secondary)
...@@ -970,38 +830,16 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do ...@@ -970,38 +830,16 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do
describe '#repositories_verification_failed_count' do describe '#repositories_verification_failed_count' do
before do before do
stub_current_geo_node(secondary) stub_current_geo_node(secondary)
end
it 'returns the right number of registries that verification failed' do
create(:geo_project_registry, :repository_verification_failed, project: project_1) create(:geo_project_registry, :repository_verification_failed, project: project_1)
create(:geo_project_registry, :repository_verification_failed, project: project_3) create(:geo_project_registry, :repository_verification_failed, project: project_3)
create(:geo_project_registry, :repository_verified) create(:geo_project_registry, :repository_verified)
create(:geo_project_registry, :wiki_verification_failed, project: project_4) create(:geo_project_registry, :wiki_verification_failed, project: project_4)
end
context 'when geo_project_registry_ssot_sync is enabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: true)
end
it 'returns the right number of registries that verification failed' do
expect(subject.repositories_verification_failed_count).to eq(2) expect(subject.repositories_verification_failed_count).to eq(2)
end end
end
context 'when geo_project_registry_ssot_sync is disabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: false)
end
it 'returns the right number of repositories that verification failed with no group restrictions' do
expect(subject.repositories_verification_failed_count).to eq(2)
end
it 'returns the right number of repositories that verification failed with group restrictions' do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [group])
expect(subject.repositories_verification_failed_count).to eq(1)
end
end
it 'returns existing value when feature flag if off' do it 'returns existing value when feature flag if off' do
allow(Gitlab::Geo).to receive(:repository_verification_enabled?).and_return(false) allow(Gitlab::Geo).to receive(:repository_verification_enabled?).and_return(false)
...@@ -1014,38 +852,16 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do ...@@ -1014,38 +852,16 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do
describe '#repositories_retrying_verification_count' do describe '#repositories_retrying_verification_count' do
before do before do
stub_current_geo_node(secondary) stub_current_geo_node(secondary)
end
it 'returns the right number of registries retrying verification' do
create(:geo_project_registry, :repository_verification_failed, repository_verification_retry_count: 1, project: project_1) create(:geo_project_registry, :repository_verification_failed, repository_verification_retry_count: 1, project: project_1)
create(:geo_project_registry, :repository_verification_failed, repository_verification_retry_count: nil, project: project_3) create(:geo_project_registry, :repository_verification_failed, repository_verification_retry_count: nil, project: project_3)
create(:geo_project_registry, :repository_verified) create(:geo_project_registry, :repository_verified)
create(:geo_project_registry, :repository_verification_failed, repository_verification_retry_count: 1, project: project_4) create(:geo_project_registry, :repository_verification_failed, repository_verification_retry_count: 1, project: project_4)
end
context 'when geo_project_registry_ssot_sync is enabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: true)
end
it 'returns the right number of registries retrying verification' do
expect(subject.repositories_retrying_verification_count).to eq(2) expect(subject.repositories_retrying_verification_count).to eq(2)
end end
end
context 'when geo_project_registry_ssot_sync is disabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: false)
end
it 'returns the right number of repositories retrying verification with no group restrictions' do
expect(subject.repositories_retrying_verification_count).to eq(2)
end
it 'returns the right number of repositories retrying verification with group restrictions' do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [group])
expect(subject.repositories_retrying_verification_count).to eq(1)
end
end
it 'returns existing value when feature flag if off' do it 'returns existing value when feature flag if off' do
allow(Gitlab::Geo).to receive(:repository_verification_enabled?).and_return(false) allow(Gitlab::Geo).to receive(:repository_verification_enabled?).and_return(false)
...@@ -1058,39 +874,17 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do ...@@ -1058,39 +874,17 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do
describe '#wikis_verified_count' do describe '#wikis_verified_count' do
before do before do
stub_current_geo_node(secondary) stub_current_geo_node(secondary)
end
it 'returns the right number of verified registries' do
create(:geo_project_registry, :wiki_verified, project: project_1) create(:geo_project_registry, :wiki_verified, project: project_1)
create(:geo_project_registry, :wiki_verified, :wiki_checksum_mismatch, project: project_3) create(:geo_project_registry, :wiki_verified, :wiki_checksum_mismatch, project: project_3)
create(:geo_project_registry, :wiki_verification_failed) create(:geo_project_registry, :wiki_verification_failed)
create(:geo_project_registry, :repository_verified, project: project_4) create(:geo_project_registry, :repository_verified, project: project_4)
end
context 'when geo_project_registry_ssot_sync is enabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: true)
end
it 'returns the right number of verified registries' do
expect(subject.wikis_verified_count).to eq(2)
end
end
context 'when geo_project_registry_ssot_sync is disabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: false)
end
it 'returns the right number of verified repositories with no group restrictions' do
expect(subject.wikis_verified_count).to eq(2) expect(subject.wikis_verified_count).to eq(2)
end end
it 'returns the right number of verified repositories with group restrictions' do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [group])
expect(subject.wikis_verified_count).to eq(1)
end
end
it 'returns existing value when feature flag if off' do it 'returns existing value when feature flag if off' do
allow(Gitlab::Geo).to receive(:repository_verification_enabled?).and_return(false) allow(Gitlab::Geo).to receive(:repository_verification_enabled?).and_return(false)
create(:geo_node_status, :healthy, geo_node: secondary) create(:geo_node_status, :healthy, geo_node: secondary)
...@@ -1102,38 +896,16 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do ...@@ -1102,38 +896,16 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do
describe '#wikis_checksum_mismatch_count' do describe '#wikis_checksum_mismatch_count' do
before do before do
stub_current_geo_node(secondary) stub_current_geo_node(secondary)
end
it 'returns the right number of registries that checksum mismatch' do
create(:geo_project_registry, :wiki_checksum_mismatch, project: project_1) create(:geo_project_registry, :wiki_checksum_mismatch, project: project_1)
create(:geo_project_registry, :wiki_checksum_mismatch, project: project_3) create(:geo_project_registry, :wiki_checksum_mismatch, project: project_3)
create(:geo_project_registry, :wiki_verified) create(:geo_project_registry, :wiki_verified)
create(:geo_project_registry, :repository_checksum_mismatch, project: project_4) create(:geo_project_registry, :repository_checksum_mismatch, project: project_4)
end
context 'when geo_project_registry_ssot_sync is enabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: true)
end
it 'returns the right number of registries that checksum mismatch' do
expect(subject.wikis_checksum_mismatch_count).to eq(2) expect(subject.wikis_checksum_mismatch_count).to eq(2)
end end
end
context 'when geo_project_registry_ssot_sync is disabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: false)
end
it 'returns the right number of repositories that checksum mismatch with no group restrictions' do
expect(subject.wikis_checksum_mismatch_count).to eq(2)
end
it 'returns the right number of repositories that checksum mismatch with group restrictions' do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [group])
expect(subject.wikis_checksum_mismatch_count).to eq(1)
end
end
it 'returns existing value when feature flag if off' do it 'returns existing value when feature flag if off' do
allow(Gitlab::Geo).to receive(:repository_verification_enabled?).and_return(false) allow(Gitlab::Geo).to receive(:repository_verification_enabled?).and_return(false)
...@@ -1146,38 +918,16 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do ...@@ -1146,38 +918,16 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do
describe '#wikis_verification_failed_count' do describe '#wikis_verification_failed_count' do
before do before do
stub_current_geo_node(secondary) stub_current_geo_node(secondary)
end
it 'returns the right number of registries that verification failed' do
create(:geo_project_registry, :wiki_verification_failed, project: project_1) create(:geo_project_registry, :wiki_verification_failed, project: project_1)
create(:geo_project_registry, :wiki_verification_failed, project: project_3) create(:geo_project_registry, :wiki_verification_failed, project: project_3)
create(:geo_project_registry, :wiki_verified) create(:geo_project_registry, :wiki_verified)
create(:geo_project_registry, :repository_verification_failed, project: project_4) create(:geo_project_registry, :repository_verification_failed, project: project_4)
end
context 'when geo_project_registry_ssot_sync is enabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: true)
end
it 'returns the right number of registries that verification failed' do
expect(subject.wikis_verification_failed_count).to eq(2) expect(subject.wikis_verification_failed_count).to eq(2)
end end
end
context 'when geo_project_registry_ssot_sync is disabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: false)
end
it 'returns the right number of repositories that verification failed with no group restrictions' do
expect(subject.wikis_verification_failed_count).to eq(2)
end
it 'returns the right number of repositories that verification failed with group restrictions' do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [group])
expect(subject.wikis_verification_failed_count).to eq(1)
end
end
it 'returns existing value when feature flag if off' do it 'returns existing value when feature flag if off' do
allow(Gitlab::Geo).to receive(:repository_verification_enabled?).and_return(false) allow(Gitlab::Geo).to receive(:repository_verification_enabled?).and_return(false)
...@@ -1190,39 +940,17 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do ...@@ -1190,39 +940,17 @@ RSpec.describe GeoNodeStatus, :geo, :geo_fdw do
describe '#wikis_retrying_verification_count' do describe '#wikis_retrying_verification_count' do
before do before do
stub_current_geo_node(secondary) stub_current_geo_node(secondary)
end
it 'returns the right number of registries retrying verification' do
create(:geo_project_registry, :wiki_verification_failed, wiki_verification_retry_count: 1, project: project_1) create(:geo_project_registry, :wiki_verification_failed, wiki_verification_retry_count: 1, project: project_1)
create(:geo_project_registry, :wiki_verification_failed, wiki_verification_retry_count: nil, project: project_3) create(:geo_project_registry, :wiki_verification_failed, wiki_verification_retry_count: nil, project: project_3)
create(:geo_project_registry, :wiki_verified) create(:geo_project_registry, :wiki_verified)
create(:geo_project_registry, :wiki_verification_failed, wiki_verification_retry_count: 1, project: project_4) create(:geo_project_registry, :wiki_verification_failed, wiki_verification_retry_count: 1, project: project_4)
end
context 'when geo_project_registry_ssot_sync is enabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: true)
end
it 'returns the right number of registries retrying verification' do
expect(subject.wikis_retrying_verification_count).to eq(2)
end
end
context 'when geo_project_registry_ssot_sync is disabled' do
before do
stub_feature_flags(geo_project_registry_ssot_sync: false)
end
it 'returns the right number of repositories retrying verification with no group restrictions' do
expect(subject.wikis_retrying_verification_count).to eq(2) expect(subject.wikis_retrying_verification_count).to eq(2)
end end
it 'returns the right number of repositories retrying verification with group restrictions' do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [group])
expect(subject.wikis_retrying_verification_count).to eq(1)
end
end
it 'returns existing value when feature flag if off' do it 'returns existing value when feature flag if off' do
allow(Gitlab::Geo).to receive(:repository_verification_enabled?).and_return(false) allow(Gitlab::Geo).to receive(:repository_verification_enabled?).and_return(false)
create(:geo_node_status, :healthy, geo_node: secondary) create(:geo_node_status, :healthy, geo_node: secondary)
......
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