Commit e3dd2680 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch...

Merge branch '7963-geo-rails-console-message-display-primary-secondary-state-incorrectly' into 'master'

Geo: Rails console message display primary/secondary state incorrectly

Closes #7963

See merge request gitlab-org/gitlab-ee!7952
parents 86a1297e 6c06d9fb
...@@ -10,7 +10,7 @@ if defined?(Rails::Console) ...@@ -10,7 +10,7 @@ if defined?(Rails::Console)
# EE-specific start # EE-specific start
if Gitlab::Geo.enabled? if Gitlab::Geo.enabled?
puts " Geo enabled:".ljust(justify) + 'yes' 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 end
# EE specific end # EE specific end
......
...@@ -9,6 +9,13 @@ module EE ...@@ -9,6 +9,13 @@ module EE
never: 'circle-o' never: 'circle-o'
}.freeze }.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 def node_vue_list_properties
version, revision = version, revision =
if ::Gitlab::Geo.primary? 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
...@@ -3789,6 +3789,15 @@ msgstr "" ...@@ -3789,6 +3789,15 @@ msgstr ""
msgid "Geo|You need a different license to use Geo replication" msgid "Geo|You need a different license to use Geo replication"
msgstr "" msgstr ""
msgid "Geo|misconfigured"
msgstr ""
msgid "Geo|primary"
msgstr ""
msgid "Geo|secondary"
msgstr ""
msgid "Get a free instance review" msgid "Get a free instance review"
msgstr "" 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