summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/health_checks/probes/collection_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/health_checks/probes/collection_spec.rb')
-rw-r--r--spec/lib/gitlab/health_checks/probes/collection_spec.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/lib/gitlab/health_checks/probes/collection_spec.rb b/spec/lib/gitlab/health_checks/probes/collection_spec.rb
index d8c411fa27b..03138e936aa 100644
--- a/spec/lib/gitlab/health_checks/probes/collection_spec.rb
+++ b/spec/lib/gitlab/health_checks/probes/collection_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe Gitlab::HealthChecks::Probes::Collection do
+RSpec.describe Gitlab::HealthChecks::Probes::Collection do
let(:readiness) { described_class.new(*checks) }
describe '#execute' do
@@ -47,6 +47,20 @@ describe Gitlab::HealthChecks::Probes::Collection do
status: 'failed', message: 'check error')
end
end
+
+ context 'when check raises exception not handled inside the check' do
+ before do
+ expect(Gitlab::HealthChecks::Redis::RedisCheck).to receive(:readiness).and_raise(
+ ::Redis::CannotConnectError, 'Redis down')
+ end
+
+ it 'responds with failure including the exception info' do
+ expect(subject.http_status).to eq(500)
+
+ expect(subject.json[:status]).to eq('failed')
+ expect(subject.json[:message]).to eq('Redis::CannotConnectError : Redis down')
+ end
+ end
end
context 'without checks' do