Commit 0a8c0f1b authored by Adrien Kohlbecker's avatar Adrien Kohlbecker Committed by Sean McGivern

Catch unhandled exceptions in health checks

parent 1877f743
---
title: Catch unhandled exceptions in health checks
merge_request: 17694
author:
type: fixed
......@@ -14,6 +14,8 @@ module Gitlab
else
HealthChecks::Result.new(false, "unexpected #{human_name} check result: #{check_result}")
end
rescue => e
HealthChecks::Result.new(false, "unexpected #{human_name} check result: #{e}")
end
def metrics
......
......@@ -57,5 +57,13 @@ shared_context 'simple_check' do |metrics_prefix, check_name, success_result|
it { is_expected.to have_attributes(success: false, message: "#{described_class.human_name} check timed out") }
end
context 'Check is raising an unhandled exception' do
before do
allow(described_class).to receive(:check ).and_raise "unexpected error"
end
it { is_expected.to have_attributes(success: false, message: "unexpected #{described_class.human_name} check result: unexpected error") }
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