diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-05-23 15:55:31 +0300 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-02 20:45:58 +0300 |
commit | 62fe37e3f8e8ccee90a748324e1b40a54f4c55c8 (patch) | |
tree | 414b83e3a4a3252cb18566ab543c94a7f3497c73 /spec/controllers | |
parent | 21561f3434021ad35d45c449f489802fd1dced67 (diff) |
move check if metrics are enabled to before action
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/metrics_controller_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/controllers/metrics_controller_spec.rb b/spec/controllers/metrics_controller_spec.rb index 7f2dcd3544f..c09c3a1f6b7 100644 --- a/spec/controllers/metrics_controller_spec.rb +++ b/spec/controllers/metrics_controller_spec.rb @@ -48,6 +48,15 @@ describe MetricsController do expect(response.body).to match(/^filesystem_read_latency{shard="default"} [0-9\.]+$/) expect(response.body).to match(/^filesystem_readable{shard="default"} 1$/) end + + context 'prometheus metrics are disabled' do + allow(Gitlab::Metrics).to receive(:prometheus_metrics_enabled?).and_return(false) + + it 'returns proper response' do + get :metrics + expect(response.status).to eq(404) + end + end end context 'without authorization token' do @@ -56,5 +65,6 @@ describe MetricsController do expect(response.status).to eq(404) end end + end end |