diff options
author | Ahmad Hassan <ahmad.hassan612@gmail.com> | 2018-12-19 19:07:33 +0200 |
---|---|---|
committer | Ahmad Hassan <ahmad.hassan612@gmail.com> | 2018-12-20 18:24:53 +0200 |
commit | d975074e1fc0d8c28da5a9ddb9ccfbd319e39046 (patch) | |
tree | 70db3fae556616e4dd6e83b47eb7d1b10944977a /spec | |
parent | 32c4f70aa585f58619c32d6c8e9db44191d82bfb (diff) | |
download | gitlab-ce-d975074e1fc0d8c28da5a9ddb9ccfbd319e39046.tar.gz |
Log certificate loading errors into sentry
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/gitaly_client_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/lib/gitlab/gitaly_client_spec.rb b/spec/lib/gitlab/gitaly_client_spec.rb index 2501e855697..d9ae73223c6 100644 --- a/spec/lib/gitlab/gitaly_client_spec.rb +++ b/spec/lib/gitlab/gitaly_client_spec.rb @@ -30,6 +30,22 @@ describe Gitlab::GitalyClient do end end + describe '.stub_certs' do + it 'skips certificates if OpenSSLError is raised and report it' do + expect(Rails.logger).to receive(:error).at_least(:once) + expect(Gitlab::Sentry) + .to receive(:track_exception) + .with( + a_kind_of(OpenSSL::X509::CertificateError), + extra: { cert_file: a_kind_of(String) }).at_least(:once) + + expect(OpenSSL::X509::Certificate) + .to receive(:new) + .and_raise(OpenSSL::X509::CertificateError).at_least(:once) + + expect(described_class.stub_certs).to be_a(String) + end + end describe '.stub_creds' do it 'returns :this_channel_is_insecure if unix' do address = 'unix:/tmp/gitaly.sock' |