diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-07-03 22:41:33 +0200 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-07-05 00:46:11 +0200 |
commit | c1b043bdb764c39c9d1af4b141b65185b71efae6 (patch) | |
tree | 323b706e07beb8306a6e25d0034338f9c3a3d57b /spec/controllers/health_check_controller_spec.rb | |
parent | 18521584bd6cfc8de9511722696e87aef59795c5 (diff) | |
download | gitlab-ce-c1b043bdb764c39c9d1af4b141b65185b71efae6.tar.gz |
Bring back healthcheck token access to monitoring resources, but mark this as deprecated
Diffstat (limited to 'spec/controllers/health_check_controller_spec.rb')
-rw-r--r-- | spec/controllers/health_check_controller_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/controllers/health_check_controller_spec.rb b/spec/controllers/health_check_controller_spec.rb index 15b3cacf623..6c545169450 100644 --- a/spec/controllers/health_check_controller_spec.rb +++ b/spec/controllers/health_check_controller_spec.rb @@ -5,6 +5,7 @@ describe HealthCheckController do let(:json_response) { JSON.parse(response.body) } let(:xml_response) { Hash.from_xml(response.body)['hash'] } + let(:token) { current_application_settings.health_check_access_token } let(:whitelisted_ip) { '127.0.0.1' } let(:not_whitelisted_ip) { '127.0.0.2' } @@ -23,6 +24,21 @@ describe HealthCheckController do get :index expect(response).to be_not_found end + + context 'when services are accessed with token' do + it 'supports passing the token in the header' do + request.headers['TOKEN'] = token + get :index + expect(response).to be_success + expect(response.content_type).to eq 'text/plain' + end + + it 'supports successful plaintest response' do + get :index, token: token + expect(response).to be_success + expect(response.content_type).to eq 'text/plain' + end + end end context 'when services are up and accessed from whitelisted ips' do |