diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-05 20:43:30 +0300 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-05 20:43:30 +0300 |
commit | a3eb8264f31a79fc05113df4276d7dcf4e0bad75 (patch) | |
tree | 51eb98ef2e43b7a97aa71db60e26742d808be85a /spec/support/prometheus | |
parent | eccc187a70a6745ca02211648814c89ff390dfa3 (diff) |
Refactor Metric tests to use more common code
Diffstat (limited to 'spec/support/prometheus')
-rw-r--r-- | spec/support/prometheus/matched_metrics_query_helper.rb | 9 | ||||
-rw-r--r-- | spec/support/prometheus/metric_builders.rb | 6 |
2 files changed, 3 insertions, 12 deletions
diff --git a/spec/support/prometheus/matched_metrics_query_helper.rb b/spec/support/prometheus/matched_metrics_query_helper.rb index 86e874fb295..0471a78e426 100644 --- a/spec/support/prometheus/matched_metrics_query_helper.rb +++ b/spec/support/prometheus/matched_metrics_query_helper.rb @@ -4,15 +4,6 @@ module Prometheus %w{metric_a metric_b} end - def simple_metrics(metric_name = 'metric_a') - [Gitlab::Prometheus::Metric.new('title', %W(#{metric_name} metric_b), nil, nil), - Gitlab::Prometheus::Metric.new('title', [metric_name], nil, nil)] - end - - def simple_metric_group(name = 'name', metrics = simple_metrics) - Gitlab::Prometheus::MetricGroup.new(name, 1, metrics) - end - def series_info_with_environment(*more_metrics) %w{metric_a metric_b}.concat(more_metrics).map { |metric_name| { '__name__' => metric_name, 'environment' => '' } } end diff --git a/spec/support/prometheus/metric_builders.rb b/spec/support/prometheus/metric_builders.rb index c57694bf7fd..4c0e01bd5f6 100644 --- a/spec/support/prometheus/metric_builders.rb +++ b/spec/support/prometheus/metric_builders.rb @@ -12,10 +12,10 @@ module Prometheus Gitlab::Prometheus::Metric.new(title, required_metrics, nil, nil, queries) end - def simple_metrics + def simple_metrics(added_metric_name: 'metric_a') [ - simple_metric(required_metrics: %w(metric_a metric_b), queries: simple_queries), - simple_metric(required_metrics: %w{metric_a}, queries: [simple_query('empty')]), + simple_metric(required_metrics: %W(#{added_metric_name} metric_b), queries: simple_queries), + simple_metric(required_metrics: [added_metric_name], queries: [simple_query('empty')]), simple_metric(required_metrics: %w{metric_c}) ] end |