Commit b83c2e28 authored by Kirstie Cook's avatar Kirstie Cook Committed by Sean McGivern

Add environment-state flag to metrics data

parent 74096b27
...@@ -38,7 +38,8 @@ module EnvironmentsHelper ...@@ -38,7 +38,8 @@ module EnvironmentsHelper
"tags-path" => project_tags_path(project), "tags-path" => project_tags_path(project),
"has-metrics" => "#{environment.has_metrics?}", "has-metrics" => "#{environment.has_metrics?}",
"prometheus-status" => "#{environment.prometheus_status}", "prometheus-status" => "#{environment.prometheus_status}",
"external-dashboard-url" => project.metrics_setting_external_dashboard_url "external-dashboard-url" => project.metrics_setting_external_dashboard_url,
"environment-state" => "#{environment.state}"
} }
end end
......
---
title: Add environment-state flag to metrics data
merge_request: 28237
author:
type: added
...@@ -33,7 +33,8 @@ describe EnvironmentsHelper do ...@@ -33,7 +33,8 @@ describe EnvironmentsHelper do
'tags-path' => project_tags_path(project), 'tags-path' => project_tags_path(project),
'has-metrics' => "#{environment.has_metrics?}", 'has-metrics' => "#{environment.has_metrics?}",
'prometheus-status' => "#{environment.prometheus_status}", 'prometheus-status' => "#{environment.prometheus_status}",
'external-dashboard-url' => nil 'external-dashboard-url' => nil,
'environment-state' => environment.state
) )
end end
...@@ -46,5 +47,15 @@ describe EnvironmentsHelper do ...@@ -46,5 +47,15 @@ describe EnvironmentsHelper do
expect(metrics_data['external-dashboard-url']).to eq('http://gitlab.com') expect(metrics_data['external-dashboard-url']).to eq('http://gitlab.com')
end end
end end
context 'when the environment is not available' do
before do
environment.stop
end
subject { metrics_data }
it { is_expected.to include('environment-state' => 'stopped') }
end
end end
end end
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