Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyasonik <syasonik@gitlab.com>2019-04-16 10:01:43 +0300
committersyasonik <syasonik@gitlab.com>2019-04-24 13:23:03 +0300
commit3d302879f431aed213c0b9d6308c7dff9a9c3958 (patch)
tree65751aa47207e4c3265a2d8ef6760bd2b49cb07d /spec/controllers
parent18183f404e492bcdb9818e2fb29b50dafdbca247 (diff)
Add unit tests and fix broken endpoint
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/projects/environments_controller_spec.rb24
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)