Commit 1c7c348e authored by Nick Thomas's avatar Nick Thomas

Fix EE-only exception to the git default user SSH config check

parent 4bcc24e6
......@@ -11,10 +11,10 @@ module SystemCheck
].freeze
set_name 'Git user has default SSH configuration?'
set_skip_reason 'skipped (GitLab read-only, or git user is not present / configured)'
set_skip_reason 'skipped (Geo uses SSH key, or git user is not present / configured)'
def skip?
Gitlab::Database.read_only? || !home_dir || !File.directory?(home_dir)
::Gitlab::Geo.current_node&.uses_ssh_key? || !home_dir || !File.directory?(home_dir)
end
def check?
......
require 'spec_helper'
describe SystemCheck::App::GitUserDefaultSSHConfigCheck do
include ::EE::GeoHelpers
let(:username) { '_this_user_will_not_exist_unless_it_is_stubbed' }
let(:base_dir) { Dir.mktmpdir }
let(:home_dir) { File.join(base_dir, "/var/lib/#{username}") }
......@@ -40,10 +42,12 @@ describe SystemCheck::App::GitUserDefaultSSHConfigCheck do
it { is_expected.to eq(expected_result) }
end
it 'skips GitLab read-only instances' do
it 'skips Geo secondaries with SSH' do
stub_user
stub_home_dir
allow(Gitlab::Database).to receive(:read_only?).and_return(true)
node = create(:geo_node, :ssh)
stub_current_geo_node(node)
is_expected.to be_truthy
end
......@@ -78,6 +82,7 @@ describe SystemCheck::App::GitUserDefaultSSHConfigCheck do
end
def stub_user
allow(File).to receive(:expand_path).and_call_original
allow(File).to receive(:expand_path).with("~#{username}").and_return(home_dir)
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