Commit 3bd42168 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'sh-geo-handle-ssl-errors' into 'master'

Gracefully handle and report SSL connection errors in Geo admin screen

Closes #3460

See merge request gitlab-org/gitlab-ee!2985
parents 1cdc0039 ba1b8c54
......@@ -41,7 +41,7 @@ module Geo
end
rescue OpenSSL::Cipher::CipherError
['Error decrypting the Geo secret from the database. Check that the primary uses the correct db_key_base.']
rescue HTTParty::Error, Timeout::Error, SocketError, Errno::ECONNRESET, Errno::ECONNREFUSED => e
rescue HTTParty::Error, Timeout::Error, SocketError, SystemCallError, OpenSSL::SSL::SSLError => e
[e.message]
end
......
......@@ -57,6 +57,23 @@ describe Geo::NodeStatusService do
expect(status.health).to eq("Could not connect to Geo node - HTTP Status Code: 401 Unauthorized\n")
end
it 'alerts on bad SSL certficate' do
message = 'bad certificate'
allow(described_class).to receive(:get).and_raise(OpenSSL::SSL::SSLError.new(message))
status = subject.call(secondary)
expect(status.health).to eq(message)
end
it 'handles connection refused' do
allow(described_class).to receive(:get).and_raise(Errno::ECONNREFUSED.new('bad connection'))
status = subject.call(secondary)
expect(status.health).to eq('Connection refused - bad connection')
end
it 'returns meaningful error message when primary uses incorrect db key' do
secondary # create it before mocking GeoNode#secret_access_key
......
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