Commit efd14c49 authored by Michael Kozono's avatar Michael Kozono

Merge branch 'alexives/239448/rename_replicator_classes' into 'master'

Rename replicator_classes methods as enabled

See merge request gitlab-org/gitlab!40321
parents a64f252e bad7b02c
...@@ -216,7 +216,7 @@ module EE ...@@ -216,7 +216,7 @@ module EE
] ]
# Adds all the SSF Data Types automatically # Adds all the SSF Data Types automatically
replicator_classes.each do |replicator_class| enabled_replicator_classes.each do |replicator_class|
replicable_types.push( replicable_types.push(
{ {
title: replicator_class.replicable_title, title: replicator_class.replicable_title,
...@@ -231,8 +231,8 @@ module EE ...@@ -231,8 +231,8 @@ module EE
replicable_types replicable_types
end end
def replicator_classes def enabled_replicator_classes
::Gitlab::Geo.replicator_classes ::Gitlab::Geo.enabled_replicator_classes
end end
end end
end end
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
%span %span
= _('Designs') = _('Designs')
- if Feature.enabled?(:geo_self_service_framework) - if Feature.enabled?(:geo_self_service_framework)
- Gitlab::Geo.replicator_classes.each do |replicator_class| - Gitlab::Geo.enabled_replicator_classes.each do |replicator_class|
= nav_link(page: [{ controller: 'admin/geo/replicables', action: 'index', replicable_name_plural: replicator_class.replicable_name_plural }], html_options: { class: 'gl-pr-2' }) do = nav_link(page: [{ controller: 'admin/geo/replicables', action: 'index', replicable_name_plural: replicator_class.replicable_name_plural }], html_options: { class: 'gl-pr-2' }) do
= link_to admin_geo_replicables_path(replicable_name_plural: replicator_class.replicable_name_plural), title: replicator_class.replicable_title_plural do = link_to admin_geo_replicables_path(replicable_name_plural: replicator_class.replicable_name_plural), title: replicator_class.replicable_title_plural do
%span %span
......
...@@ -78,7 +78,7 @@ module Geo ...@@ -78,7 +78,7 @@ module Geo
end end
def replicator_classes def replicator_classes
Gitlab::Geo.replicator_classes Gitlab::Geo.enabled_replicator_classes
end end
end end
end end
...@@ -166,7 +166,7 @@ module Gitlab ...@@ -166,7 +166,7 @@ module Gitlab
_(template) % { url: url } _(template) % { url: url }
end end
def self.replicator_classes def self.enabled_replicator_classes
REPLICATOR_CLASSES.select(&:enabled?) REPLICATOR_CLASSES.select(&:enabled?)
end end
end end
......
...@@ -164,7 +164,7 @@ module Gitlab ...@@ -164,7 +164,7 @@ module Gitlab
end end
def print_replicators_status def print_replicators_status
Gitlab::Geo.replicator_classes.each do |replicator_class| Gitlab::Geo.enabled_replicator_classes.each do |replicator_class|
print "#{replicator_class.replicable_title_plural}: ".rjust(GEO_STATUS_COLUMN_WIDTH) print "#{replicator_class.replicable_title_plural}: ".rjust(GEO_STATUS_COLUMN_WIDTH)
show_failed_value(replicator_class.failed_count) show_failed_value(replicator_class.failed_count)
...@@ -246,7 +246,7 @@ module Gitlab ...@@ -246,7 +246,7 @@ module Gitlab
end end
def print_replicators_checked_status def print_replicators_checked_status
Gitlab::Geo.replicator_classes.each do |replicator_class| Gitlab::Geo.enabled_replicator_classes.each do |replicator_class|
print "#{replicator_class.replicable_title_plural} Checked: ".rjust(GEO_STATUS_COLUMN_WIDTH) print "#{replicator_class.replicable_title_plural} Checked: ".rjust(GEO_STATUS_COLUMN_WIDTH)
show_failed_value(replicator_class.checksum_failed_count) show_failed_value(replicator_class.checksum_failed_count)
print "#{replicator_class.checksummed_count}/#{replicator_class.registry_count} " print "#{replicator_class.checksummed_count}/#{replicator_class.registry_count} "
...@@ -275,7 +275,7 @@ module Gitlab ...@@ -275,7 +275,7 @@ module Gitlab
r.push current_node_status.container_repositories_failed_count r.push current_node_status.container_repositories_failed_count
end end
Gitlab::Geo.replicator_classes.each do |replicator_class| Gitlab::Geo.enabled_replicator_classes.each do |replicator_class|
r.push replicator_class.failed_count r.push replicator_class.failed_count
end end
end end
...@@ -294,7 +294,7 @@ module Gitlab ...@@ -294,7 +294,7 @@ module Gitlab
v.push current_node_status.repositories_checked_failed_count v.push current_node_status.repositories_checked_failed_count
end end
Gitlab::Geo.replicator_classes.each do |replicator_class| Gitlab::Geo.enabled_replicator_classes.each do |replicator_class|
v.push replicator_class.checksum_failed_count v.push replicator_class.checksum_failed_count
end end
end end
......
...@@ -45,7 +45,7 @@ RSpec.describe 'admin Geo Replication Nav', :js, :geo do ...@@ -45,7 +45,7 @@ RSpec.describe 'admin Geo Replication Nav', :js, :geo do
end end
describe 'visit admin/geo/replication/*' do describe 'visit admin/geo/replication/*' do
Gitlab::Geo.replicator_classes.each do |replicator_class| Gitlab::Geo.enabled_replicator_classes.each do |replicator_class|
it_behaves_like 'active sidebar link', replicator_class.replicable_title_plural do it_behaves_like 'active sidebar link', replicator_class.replicable_title_plural do
let(:path) { admin_geo_replicables_path(replicable_name_plural: replicator_class.replicable_name_plural) } let(:path) { admin_geo_replicables_path(replicable_name_plural: replicator_class.replicable_name_plural) }
end end
......
...@@ -65,7 +65,7 @@ RSpec.describe 'admin Geo Sidebar', :js, :geo do ...@@ -65,7 +65,7 @@ RSpec.describe 'admin Geo Sidebar', :js, :geo do
end end
describe 'visiting geo replicables' do describe 'visiting geo replicables' do
Gitlab::Geo.replicator_classes.each do |replicator_class| Gitlab::Geo.enabled_replicator_classes.each do |replicator_class|
it_behaves_like 'active sidebar link', 'Replication' do it_behaves_like 'active sidebar link', 'Replication' do
let(:path) { admin_geo_replicables_path(replicable_name_plural: replicator_class.replicable_name_plural) } let(:path) { admin_geo_replicables_path(replicable_name_plural: replicator_class.replicable_name_plural) }
end end
......
...@@ -39,7 +39,7 @@ RSpec.describe EE::GeoHelper do ...@@ -39,7 +39,7 @@ RSpec.describe EE::GeoHelper do
end end
it 'includes replicator types' do it 'includes replicator types' do
expected_names = helper.replicator_classes.map { |c| c.replicable_name_plural } expected_names = helper.enabled_replicator_classes.map { |c| c.replicable_name_plural }
expect(names).to include(*expected_names) expect(names).to include(*expected_names)
end end
......
...@@ -336,9 +336,9 @@ RSpec.describe Gitlab::Geo, :geo, :request_store do ...@@ -336,9 +336,9 @@ RSpec.describe Gitlab::Geo, :geo, :request_store do
end end
end end
describe '.replicator_classes' do describe '.enabled_replicator_classes' do
it 'returns an Array of replicator classes' do it 'returns an Array of replicator classes' do
result = described_class.replicator_classes result = described_class.enabled_replicator_classes
expect(result).to be_an(Array) expect(result).to be_an(Array)
expect(result).to include(Geo::PackageFileReplicator) expect(result).to include(Geo::PackageFileReplicator)
...@@ -350,7 +350,7 @@ RSpec.describe Gitlab::Geo, :geo, :request_store do ...@@ -350,7 +350,7 @@ RSpec.describe Gitlab::Geo, :geo, :request_store do
end end
it 'does not return the replicator class' do it 'does not return the replicator class' do
expect(described_class.replicator_classes).not_to include(Geo::PackageFileReplicator) expect(described_class.enabled_replicator_classes).not_to include(Geo::PackageFileReplicator)
end end
end end
end end
......
...@@ -45,7 +45,7 @@ RSpec.describe 'EE-specific admin routing' do ...@@ -45,7 +45,7 @@ RSpec.describe 'EE-specific admin routing' do
end end
describe Admin::Geo::ReplicablesController, 'routing' do describe Admin::Geo::ReplicablesController, 'routing' do
Gitlab::Geo.replicator_classes.map(&:replicable_name_plural).each do |replicable_name_plural| Gitlab::Geo.enabled_replicator_classes.map(&:replicable_name_plural).each do |replicable_name_plural|
it "routes /admin/geo/replication/#{replicable_name_plural} to replicables#index" do it "routes /admin/geo/replication/#{replicable_name_plural} to replicables#index" do
expect(get("/admin/geo/replication/#{replicable_name_plural}")).to route_to('admin/geo/replicables#index', replicable_name_plural: replicable_name_plural) expect(get("/admin/geo/replication/#{replicable_name_plural}")).to route_to('admin/geo/replicables#index', replicable_name_plural: replicable_name_plural)
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