diff options
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/prometheus/metric_group_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/lib/gitlab/prometheus/metric_group_spec.rb b/spec/lib/gitlab/prometheus/metric_group_spec.rb new file mode 100644 index 00000000000..fa36b83f575 --- /dev/null +++ b/spec/lib/gitlab/prometheus/metric_group_spec.rb @@ -0,0 +1,22 @@ +require 'rails_helper' + +describe Gitlab::Prometheus::MetricGroup do + describe '.common_metrics' do + set(:project_metric) { create(:prometheus_metric) } + set(:common_metric_group_a) { create(:prometheus_metric, :common, group: :aws_elb) } + set(:common_metric_group_b_q1) { create(:prometheus_metric, :common, group: :kubernetes) } + set(:common_metric_group_b_q2) { create(:prometheus_metric, :common, group: :kubernetes) } + + subject { described_class.common_metrics } + + it 'returns exactly two groups' do + expect(subject.map(&:name)).to contain_exactly('Response metrics (AWS ELB)', 'System metrics (Kubernetes)') + end + + it 'returns exactly three metric queries' do + expect(subject.map(&:metrics).flatten.map(&:queries)).to contain_exactly( + common_metric_group_a.queries, common_metric_group_b_q1.queries, + common_metric_group_b_q2.queries) + end + end +end |