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

Merge branch...

Merge branch '7197-remove-can-primary-connect-to-secondary-check-from-gitlab-geo-check' into 'master'

Geo: Remove connectivity check from primary to secondary from gitlab:geo:check rake task

Closes #7197

See merge request gitlab-org/gitlab-ee!7821
parents 57e9d641 8c266897
---
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