Refactor spec for Geo::ProjectRegistryFinder

parent 74eae236
...@@ -163,12 +163,16 @@ module Geo ...@@ -163,12 +163,16 @@ module Geo
private private
def fdw_disabled?
!Gitlab::Geo::Fdw.enabled?
end
def use_legacy_queries_for_selective_sync? def use_legacy_queries_for_selective_sync?
selective_sync? && !Gitlab::Geo::Fdw.enabled_for_selective_sync? fdw_disabled? || selective_sync? && !Gitlab::Geo::Fdw.enabled_for_selective_sync?
end end
def finder_klass_for_synced_registries def finder_klass_for_synced_registries
if !Gitlab::Geo::Fdw.enabled? || use_legacy_queries_for_selective_sync? if use_legacy_queries_for_selective_sync?
Geo::LegacyProjectRegistrySyncedFinder Geo::LegacyProjectRegistrySyncedFinder
else else
Geo::ProjectRegistrySyncedFinder Geo::ProjectRegistrySyncedFinder
...@@ -182,7 +186,7 @@ module Geo ...@@ -182,7 +186,7 @@ module Geo
end end
def finder_klass_for_failed_registries def finder_klass_for_failed_registries
if !Gitlab::Geo::Fdw.enabled? || use_legacy_queries_for_selective_sync? if use_legacy_queries_for_selective_sync?
Geo::LegacyProjectRegistrySyncFailedFinder Geo::LegacyProjectRegistrySyncFailedFinder
else else
Geo::ProjectRegistrySyncFailedFinder Geo::ProjectRegistrySyncFailedFinder
...@@ -196,7 +200,7 @@ module Geo ...@@ -196,7 +200,7 @@ module Geo
end end
def finder_klass_for_verified_registries def finder_klass_for_verified_registries
if !Gitlab::Geo::Fdw.enabled? || use_legacy_queries_for_selective_sync? if use_legacy_queries_for_selective_sync?
Geo::LegacyProjectRegistryVerifiedFinder Geo::LegacyProjectRegistryVerifiedFinder
else else
Geo::ProjectRegistryVerifiedFinder Geo::ProjectRegistryVerifiedFinder
...@@ -210,10 +214,10 @@ module Geo ...@@ -210,10 +214,10 @@ module Geo
end end
def finder_klass_for_verification_failed_registries def finder_klass_for_verification_failed_registries
if Gitlab::Geo::Fdw.enabled_for_selective_sync? if use_legacy_queries_for_selective_sync?
Geo::ProjectRegistryVerificationFailedFinder
else
Geo::LegacyProjectRegistryVerificationFailedFinder Geo::LegacyProjectRegistryVerificationFailedFinder
else
Geo::ProjectRegistryVerificationFailedFinder
end end
end end
...@@ -224,10 +228,10 @@ module Geo ...@@ -224,10 +228,10 @@ module Geo
end end
def finder_klass_for_registries_retrying_verification def finder_klass_for_registries_retrying_verification
if Gitlab::Geo::Fdw.enabled_for_selective_sync? if use_legacy_queries_for_selective_sync?
Geo::ProjectRegistryRetryingVerificationFinder
else
Geo::LegacyProjectRegistryRetryingVerificationFinder Geo::LegacyProjectRegistryRetryingVerificationFinder
else
Geo::ProjectRegistryRetryingVerificationFinder
end end
end end
...@@ -238,10 +242,10 @@ module Geo ...@@ -238,10 +242,10 @@ module Geo
end end
def finder_klass_for_mismatch_registries def finder_klass_for_mismatch_registries
if Gitlab::Geo::Fdw.enabled_for_selective_sync? if use_legacy_queries_for_selective_sync?
Geo::ProjectRegistryMismatchFinder
else
Geo::LegacyProjectRegistryMismatchFinder Geo::LegacyProjectRegistryMismatchFinder
else
Geo::ProjectRegistryMismatchFinder
end end
end end
...@@ -252,7 +256,7 @@ module Geo ...@@ -252,7 +256,7 @@ module Geo
end end
def finder_klass_for_registries_pending_verification def finder_klass_for_registries_pending_verification
if !Gitlab::Geo::Fdw.enabled? || use_legacy_queries_for_selective_sync? if use_legacy_queries_for_selective_sync?
Geo::LegacyProjectRegistryPendingVerificationFinder Geo::LegacyProjectRegistryPendingVerificationFinder
else else
Geo::ProjectRegistryPendingVerificationFinder Geo::ProjectRegistryPendingVerificationFinder
......
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