Commit 8c266897 authored by Valery Sizov's avatar Valery Sizov

Fix connectivity check in rake gitlab:geo:check

Historically, this check was there to ensure the primary could
pull the status information from the secondary. This fix removes
that check
parent f9b46e30
---
title: 'Geo: Remove connectivity check from primary to secondary from gitlab:geo:check
rake task'
merge_request: 7821
author:
type: fixed
......@@ -2,27 +2,31 @@ module SystemCheck
module Geo
class HttpConnectionCheck < SystemCheck::BaseCheck
set_name 'GitLab Geo HTTP(S) connectivity'
set_skip_reason 'Geo is not enabled'
NOT_SECONDARY_NODE = 'not a secondary node'.freeze
GEO_NOT_ENABLED = 'Geo is not enabled'.freeze
def skip?
!Gitlab::Geo.enabled?
unless Gitlab::Geo.enabled?
self.skip_reason = GEO_NOT_ENABLED
return true
end
def multi_check
$stdout.puts
unless Gitlab::Geo.secondary?
self.skip_reason = NOT_SECONDARY_NODE
if Gitlab::Geo.primary?
Gitlab::Geo.secondary_nodes.each do |node|
$stdout.print "* Can connect to secondary node: '#{node.url}' ... "
check_gitlab_geo_node(node)
return true
end
false
end
if Gitlab::Geo.secondary?
def multi_check
$stdout.puts
$stdout.print '* Can connect to the primary node ... '
check_gitlab_geo_node(Gitlab::Geo.primary_node)
end
end
private
......
# frozen_string_literal: true
require 'spec_helper'
describe SystemCheck::Geo::HttpConnectionCheck do
describe 'skip?' do
it 'skips when Geo is disabled' do
allow(Gitlab::Geo).to receive(:enabled?) { false }
expect(subject.skip?).to be_truthy
expect(subject.skip_reason).to eq('Geo is not enabled')
end
it 'skips when Geo is enabled but its a primary node' do
allow(Gitlab::Geo).to receive(:enabled?) { true }
allow(Gitlab::Geo).to receive(:secondary?) { false }
expect(subject.skip?).to be_truthy
expect(subject.skip_reason).to eq('not a secondary node')
end
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