diff options
author | syasonik <syasonik@gitlab.com> | 2019-04-16 15:01:43 +0800 |
---|---|---|
committer | syasonik <syasonik@gitlab.com> | 2019-04-24 18:23:03 +0800 |
commit | 3d302879f431aed213c0b9d6308c7dff9a9c3958 (patch) | |
tree | 65751aa47207e4c3265a2d8ef6760bd2b49cb07d /spec/controllers | |
parent | 18183f404e492bcdb9818e2fb29b50dafdbca247 (diff) | |
download | gitlab-ce-3d302879f431aed213c0b9d6308c7dff9a9c3958.tar.gz |
Add unit tests and fix broken endpoint
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/environments_controller_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/controllers/projects/environments_controller_spec.rb b/spec/controllers/projects/environments_controller_spec.rb index 75158f2e8e0..02441385da0 100644 --- a/spec/controllers/projects/environments_controller_spec.rb +++ b/spec/controllers/projects/environments_controller_spec.rb @@ -461,6 +461,30 @@ describe Projects::EnvironmentsController do end end + describe 'metrics_dashboard' do + context 'when prometheus endpoint is disabled' do + before do + stub_feature_flags(environment_metrics_use_prometheus_endpoint: false) + end + + it 'responds with status code 403' do + get :metrics_dashboard, params: environment_params(format: :json) + + expect(response).to have_gitlab_http_status(:forbidden) + end + end + + context 'when prometheus endpoint is enabled' do + it 'returns a json representation of the environment dashboard' do + get :metrics_dashboard, params: environment_params(format: :json) + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response).to include('dashboard', 'order', 'panel_groups') + expect(json_response['panel_groups']).to all( include('group', 'priority', 'panels') ) + end + end + end + describe 'GET #search' do before do create(:environment, name: 'staging', project: project) |