diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-05 21:11:22 +0300 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-05 21:11:22 +0300 |
commit | ffedc52eaa33a7a31d3a7b4893387e81163a3d5f (patch) | |
tree | b520cbc6eb3cc38294bbe3149a57149f4d227653 /spec/lib/gitlab/prometheus | |
parent | a3eb8264f31a79fc05113df4276d7dcf4e0bad75 (diff) |
Cleanup Additional Metrics tests
Diffstat (limited to 'spec/lib/gitlab/prometheus')
3 files changed, 11 insertions, 10 deletions
diff --git a/spec/lib/gitlab/prometheus/queries/additional_metrics_deployment_query_spec.rb b/spec/lib/gitlab/prometheus/queries/additional_metrics_deployment_query_spec.rb index 93a9ce38d80..836f2be629f 100644 --- a/spec/lib/gitlab/prometheus/queries/additional_metrics_deployment_query_spec.rb +++ b/spec/lib/gitlab/prometheus/queries/additional_metrics_deployment_query_spec.rb @@ -1,22 +1,14 @@ require 'spec_helper' describe Gitlab::Prometheus::Queries::AdditionalMetricsDeploymentQuery, lib: true do - include Prometheus::AdditionalMetricsQueryHelper include Prometheus::MetricBuilders - let(:metric_group_class) { Gitlab::Prometheus::MetricGroup } - let(:metric_class) { Gitlab::Prometheus::Metric } - let(:client) { double('prometheus_client') } let(:environment) { create(:environment, slug: 'environment-slug') } let(:deployment) { create(:deployment, environment: environment) } subject(:query_result) { described_class.new(client).query(deployment.id) } - around do |example| - Timecop.freeze { example.run } - end - include_examples 'additional metrics query' do it 'queries using specific time' do expect(client).to receive(:query_range).with(anything, diff --git a/spec/lib/gitlab/prometheus/queries/additional_metrics_query_spec.rb b/spec/lib/gitlab/prometheus/queries/additional_metrics_query_spec.rb index e5db1326597..6fbd2fd17d6 100644 --- a/spec/lib/gitlab/prometheus/queries/additional_metrics_query_spec.rb +++ b/spec/lib/gitlab/prometheus/queries/additional_metrics_query_spec.rb @@ -1,7 +1,6 @@ require 'spec_helper' describe Gitlab::Prometheus::Queries::AdditionalMetricsQuery, lib: true do - include Prometheus::AdditionalMetricsQueryHelper include Prometheus::MetricBuilders let(:client) { double('prometheus_client') } diff --git a/spec/lib/gitlab/prometheus/queries/matched_metrics_query_spec.rb b/spec/lib/gitlab/prometheus/queries/matched_metrics_query_spec.rb index 34f11205878..2395675a247 100644 --- a/spec/lib/gitlab/prometheus/queries/matched_metrics_query_spec.rb +++ b/spec/lib/gitlab/prometheus/queries/matched_metrics_query_spec.rb @@ -1,12 +1,22 @@ require 'spec_helper' describe Gitlab::Prometheus::Queries::MatchedMetricsQuery, lib: true do - include Prometheus::MatchedMetricsQueryHelper include Prometheus::MetricBuilders let(:metric_group_class) { Gitlab::Prometheus::MetricGroup } let(:metric_class) { Gitlab::Prometheus::Metric } + def series_info_with_environment(*more_metrics) + %w{metric_a metric_b}.concat(more_metrics).map { |metric_name| { '__name__' => metric_name, 'environment' => '' } } + end + let(:metric_names) { %w{metric_a metric_b} } + let(:series_info_without_environment) do + [{ '__name__' => 'metric_a' }, + { '__name__' => 'metric_b' }] + end + let(:partialy_empty_series_info) { [{ '__name__' => 'metric_a', 'environment' => '' }] } + let(:empty_series_info) { [] } + let(:client) { double('prometheus_client') } subject { described_class.new(client) } |