From ffedc52eaa33a7a31d3a7b4893387e81163a3d5f Mon Sep 17 00:00:00 2001 From: Pawel Chojnacki Date: Mon, 5 Jun 2017 20:11:22 +0200 Subject: Cleanup Additional Metrics tests --- .../prometheus/additional_metrics_query_helper.rb | 31 ---------------------- .../additional_metrics_shared_examples.rb | 12 ++++++--- .../prometheus/matched_metrics_query_helper.rb | 24 ----------------- 3 files changed, 9 insertions(+), 58 deletions(-) delete mode 100644 spec/support/prometheus/additional_metrics_query_helper.rb delete mode 100644 spec/support/prometheus/matched_metrics_query_helper.rb (limited to 'spec/support') diff --git a/spec/support/prometheus/additional_metrics_query_helper.rb b/spec/support/prometheus/additional_metrics_query_helper.rb deleted file mode 100644 index 84cbc24a301..00000000000 --- a/spec/support/prometheus/additional_metrics_query_helper.rb +++ /dev/null @@ -1,31 +0,0 @@ -module Prometheus - module AdditionalMetricsQueryHelper - def metric_names - %w{metric_a metric_b} - end - - def query_result - [ - { - 'metric': {}, - 'value': [ - 1488772511.004, - '0.000041021495238095323' - ] - } - ] - end - - def query_range_result - [ - { - 'metric': {}, - 'values': [ - [1488758662.506, '0.00002996364761904785'], - [1488758722.506, '0.00003090239047619091'] - ] - } - ] - end - end -end diff --git a/spec/support/prometheus/additional_metrics_shared_examples.rb b/spec/support/prometheus/additional_metrics_shared_examples.rb index 96a9e1f5049..449a53664c1 100644 --- a/spec/support/prometheus/additional_metrics_shared_examples.rb +++ b/spec/support/prometheus/additional_metrics_shared_examples.rb @@ -1,14 +1,20 @@ RSpec.shared_examples 'additional metrics query' do include Prometheus::MetricBuilders + let(:metric_group_class) { Gitlab::Prometheus::MetricGroup } + let(:metric_class) { Gitlab::Prometheus::Metric } + + let(:metric_names) { %w{metric_a metric_b} } + + let(:query_range_result) do + [{ 'metric': {}, 'values': [[1488758662.506, '0.00002996364761904785'], [1488758722.506, '0.00003090239047619091']] }] + end + before do allow(client).to receive(:label_values).and_return(metric_names) allow(metric_group_class).to receive(:all).and_return([simple_metric_group(metrics: [simple_metric])]) end - let(:metric_group_class) { Gitlab::Prometheus::MetricGroup } - let(:metric_class) { Gitlab::Prometheus::Metric } - context 'with one group where two metrics is found' do before do allow(metric_group_class).to receive(:all).and_return([simple_metric_group]) diff --git a/spec/support/prometheus/matched_metrics_query_helper.rb b/spec/support/prometheus/matched_metrics_query_helper.rb deleted file mode 100644 index 0471a78e426..00000000000 --- a/spec/support/prometheus/matched_metrics_query_helper.rb +++ /dev/null @@ -1,24 +0,0 @@ -module Prometheus - module MatchedMetricsQueryHelper - def metric_names - %w{metric_a metric_b} - end - - def series_info_with_environment(*more_metrics) - %w{metric_a metric_b}.concat(more_metrics).map { |metric_name| { '__name__' => metric_name, 'environment' => '' } } - end - - def series_info_without_environment - [{ '__name__' => 'metric_a' }, - { '__name__' => 'metric_b' }] - end - - def partialy_empty_series_info - [{ '__name__' => 'metric_a', 'environment' => '' }] - end - - def empty_series_info - [] - end - end -end -- cgit v1.2.3