Commit 6c06d9fb authored by Valery Sizov's avatar Valery Sizov

Geo: Rails console message fix

Geo: Rails console message display primary/secondary state incorrectly
parent 562618d3
......@@ -10,7 +10,7 @@ if defined?(Rails::Console)
# EE-specific start
if Gitlab::Geo.enabled?
puts " Geo enabled:".ljust(justify) + 'yes'
puts " Geo server:".ljust(justify) + (Gitlab::Geo.primary? ? 'primary' : 'secondary')
puts " Geo server:".ljust(justify) + EE::GeoHelper.current_node_human_status
end
# EE specific end
......
......@@ -9,6 +9,13 @@ module EE
never: 'circle-o'
}.freeze
def self.current_node_human_status
return s_('Geo|primary') if ::Gitlab::Geo.primary?
return s_('Geo|secondary') if ::Gitlab::Geo.secondary?
s_('Geo|misconfigured')
end
def node_vue_list_properties
version, revision =
if ::Gitlab::Geo.primary?
......
---
title: 'Geo: Rails console message display primary/secondary state incorrectly'
merge_request:
author:
type: fixed
# frozen_string_literal: true
require 'spec_helper'
describe EE::GeoHelper do
describe '.current_node_human_status' do
where(:primary, :secondary, :result) do
[
[true, false, 'primary'],
[false, true, 'secondary'],
[false, false, 'misconfigured']
]
end
with_them do
it 'returns correct results' do
allow(::Gitlab::Geo).to receive(:primary?).and_return(primary)
allow(::Gitlab::Geo).to receive(:secondary?).and_return(secondary)
expect(described_class.current_node_human_status).to eq result
end
end
end
end
......@@ -3768,6 +3768,15 @@ msgstr ""
msgid "Geo|You need a different license to use Geo replication"
msgstr ""
msgid "Geo|misconfigured"
msgstr ""
msgid "Geo|primary"
msgstr ""
msgid "Geo|secondary"
msgstr ""
msgid "Get a free instance review"
msgstr ""
......
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