summaryrefslogtreecommitdiff
path: root/spec/db
diff options
context:
space:
mode:
authorrpereira2 <rpereira@gitlab.com>2018-12-21 16:41:58 +0530
committerrpereira2 <rpereira@gitlab.com>2018-12-21 16:41:58 +0530
commit2cd7b783910230bec4c6a704d820631e3ff048ed (patch)
treed98625e8c68e437ac973095cded9b7ea0be39861 /spec/db
parented4994c3ac1121b8f8ca93e2378b3b5d2ae0927d (diff)
downloadgitlab-ce-2cd7b783910230bec4c6a704d820631e3ff048ed.tar.gz
Correct ordering of metrics
Correct the ordering of metrics on performance dashboard. Before common metrics were moved into the DB, metric groups were ordered by the priority defined in the common_metrics.yml file. This commit adds a priority to each metric group in the PrometheusMetric model. It also combines title, priority and required_metrics into one frozen GROUP_DETAILS hash so that the code is clearer. This can be done since there is a fixed set of groups which are not configurable.
Diffstat (limited to 'spec/db')
-rw-r--r--spec/db/importers/common_metrics_importer_spec.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/db/importers/common_metrics_importer_spec.rb b/spec/db/importers/common_metrics_importer_spec.rb
index 68260820958..6133b17ac61 100644
--- a/spec/db/importers/common_metrics_importer_spec.rb
+++ b/spec/db/importers/common_metrics_importer_spec.rb
@@ -4,12 +4,18 @@ require 'rails_helper'
require Rails.root.join("db", "importers", "common_metrics_importer.rb")
describe Importers::PrometheusMetric do
+ let(:existing_group_titles) do
+ ::PrometheusMetric::GROUP_DETAILS.each_with_object({}) do |(key, value), memo|
+ memo[key] = value[:group_title]
+ end
+ end
+
it 'group enum equals ::PrometheusMetric' do
expect(described_class.groups).to eq(::PrometheusMetric.groups)
end
it 'GROUP_TITLES equals ::PrometheusMetric' do
- expect(described_class::GROUP_TITLES).to eq(::PrometheusMetric::GROUP_TITLES)
+ expect(described_class::GROUP_TITLES).to eq(existing_group_titles)
end
end