Commit f6b1a0c3 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'ak/health-check-custom-error' into 'master'

Disable gitlab-workhorse static error page on health endpoints

See merge request gitlab-org/gitlab!17770
parents 58182ede 7441472e
......@@ -41,6 +41,10 @@ class HealthController < ActionController::Base
info[:labels] = r.labels if r.labels
[name, info]
end
# disable static error pages at the gitlab-workhorse level, we want to see this error response even in production
headers["X-GitLab-Custom-Error"] = 1 unless success
render json: response.to_h, status: success ? :ok : :service_unavailable
end
end
---
title: Disable gitlab-workhorse static error page on health endpoints
merge_request: 17770
author:
type: fixed
......@@ -30,6 +30,19 @@ describe HealthController do
expect(json_response['shared_state_check']['status']).to eq('ok')
expect(json_response['gitaly_check']['status']).to eq('ok')
end
it 'responds with readiness checks data when a failure happens' do
allow(Gitlab::HealthChecks::Redis::RedisCheck).to receive(:readiness).and_return(Gitlab::HealthChecks::Result.new(false, "check error"))
subject
expect(json_response['redis_check']['status']).to eq('failed')
expect(json_response['redis_check']['message']).to eq('check error')
expect(json_response['cache_check']['status']).to eq('ok')
expect(response.status).to eq(503)
expect(response.headers['X-GitLab-Custom-Error']).to eq(1)
end
end
context 'accessed from whitelisted ip' do
......
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