summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2017-06-06 11:16:15 +0200
committerPawel Chojnacki <pawel@chojnacki.ws>2017-06-06 11:16:15 +0200
commitc0a66dbd2dd8b716e809938d20e7655d84595176 (patch)
treecf26784db5523f476399c74f7fab3b467ee4d92e /spec
parent336cef434372244b9f17bd1fd222e54f8b70979e (diff)
downloadgitlab-ce-c0a66dbd2dd8b716e809938d20e7655d84595176.tar.gz
Fix prometheus service tests
Diffstat (limited to 'spec')
-rw-r--r--spec/models/project_services/prometheus_service_spec.rb5
-rw-r--r--spec/support/prometheus_helpers.rb13
2 files changed, 16 insertions, 2 deletions
diff --git a/spec/models/project_services/prometheus_service_spec.rb b/spec/models/project_services/prometheus_service_spec.rb
index 1f9d3c07b51..b761567ad76 100644
--- a/spec/models/project_services/prometheus_service_spec.rb
+++ b/spec/models/project_services/prometheus_service_spec.rb
@@ -61,7 +61,7 @@ describe PrometheusService, models: true, caching: true do
end
it 'returns reactive data' do
- is_expected.to eq(prometheus_data)
+ is_expected.to eq(prometheus_metrics_data)
end
end
end
@@ -82,7 +82,7 @@ describe PrometheusService, models: true, caching: true do
end
it 'returns reactive data' do
- is_expected.to eq(prometheus_data.merge(deployment_time: deployment.created_at.to_i))
+ is_expected.to eq(prometheus_metrics_data.merge(deployment_time: deployment.created_at.to_i))
end
end
end
@@ -112,6 +112,7 @@ describe PrometheusService, models: true, caching: true do
end
it { expect(subject.to_json).to eq(prometheus_data.to_json) }
+ it { expect(subject.to_json).to eq(prometheus_data.to_json) }
end
[404, 500].each do |status|
diff --git a/spec/support/prometheus_helpers.rb b/spec/support/prometheus_helpers.rb
index e49902475da..4212be2cc88 100644
--- a/spec/support/prometheus_helpers.rb
+++ b/spec/support/prometheus_helpers.rb
@@ -98,6 +98,19 @@ module PrometheusHelpers
def prometheus_data(last_update: Time.now.utc)
{
success: true,
+ data: {
+ memory_values: prometheus_values_body('matrix').dig(:data, :result),
+ memory_current: prometheus_value_body('vector').dig(:data, :result),
+ cpu_values: prometheus_values_body('matrix').dig(:data, :result),
+ cpu_current: prometheus_value_body('vector').dig(:data, :result)
+ },
+ last_update: last_update
+ }
+ end
+
+ def prometheus_metrics_data(last_update: Time.now.utc)
+ {
+ success: true,
metrics: {
memory_values: prometheus_values_body('matrix').dig(:data, :result),
memory_current: prometheus_value_body('vector').dig(:data, :result),