Commit c0a66dbd authored by Pawel Chojnacki's avatar Pawel Chojnacki

Fix prometheus service tests

parent 336cef43
......@@ -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|
......
......@@ -96,6 +96,19 @@ module PrometheusHelpers
end
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: {
......
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