Commit c754f4ad authored by Sean McGivern's avatar Sean McGivern

Merge branch 'ak/unhandled-exception-in-health-checks' into 'master'

Catch unhandled exceptions in health checks

Closes #23927

See merge request gitlab-org/gitlab!17694
parents 1877f743 0a8c0f1b
---
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