Commit 1b6ab2df authored by Pawel Chojnacki's avatar Pawel Chojnacki

Remove orig file + rubocop cleanup

parent ffedc52e
module Gitlab::Prometheus::Queries
class AdditionalMetricsDeploymentQuery < AdditionalMetricsQuery
def query(deployment_id)
deployment = Deployment.find_by(id: deployment_id)
query_context = {
......@@ -14,4 +13,3 @@ module Gitlab::Prometheus::Queries
end
end
end
......@@ -40,11 +40,11 @@ module Gitlab::Prometheus::Queries
private
def metric_with_any_queries(metric)
metric[:queries]&.count > 0
metric[:queries]&.count&.> 0
end
def group_with_any_metrics(group)
group[:metrics]&.count > 0
group[:metrics]&.count&.> 0
end
def query_with_result(query)
......@@ -64,7 +64,6 @@ module Gitlab::Prometheus::Queries
query_with_result
end
def available_metrics
@available_metrics ||= client_label_values || []
end
......
......@@ -29,7 +29,7 @@ module Gitlab
end
end
def label_values(name='__name__')
def label_values(name = '__name__')
json_api_get("label/#{name}/values")
end
......
require 'spec_helper'
describe 'seed production settings', lib: true do
include StubENV
context 'GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN is set in the environment' do
before do
stub_env('GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN', '013456789')
end
it 'writes the token to the database' do
load(File.join(__dir__, '../../../db/fixtures/production/010_settings.rb'))
expect(ApplicationSetting.current.runners_registration_token).to eq('013456789')
end
end
end
......@@ -9,6 +9,7 @@ describe Gitlab::Prometheus::Queries::MatchedMetricsQuery, lib: true do
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' },
......@@ -110,7 +111,9 @@ describe Gitlab::Prometheus::Queries::MatchedMetricsQuery, lib: true do
it 'responds with one metrics as active and no missing requiremens' do
expect(subject.query).to eq([
{ group: 'name', priority: 1, active_metrics: 1, metrics_missing_requirements: 0 },
{ group: 'nameb', priority: 1, active_metrics: 2, metrics_missing_requirements: 0 }])
{ group: 'nameb', priority: 1, active_metrics: 2, metrics_missing_requirements: 0 }
]
)
end
end
......@@ -122,7 +125,9 @@ describe Gitlab::Prometheus::Queries::MatchedMetricsQuery, lib: true do
it 'responds with one metrics as active and no missing requiremens' do
expect(subject.query).to eq([
{ group: 'name', priority: 1, active_metrics: 0, metrics_missing_requirements: 1 },
{ group: 'nameb', priority: 1, active_metrics: 0, metrics_missing_requirements: 2 }])
{ group: 'nameb', priority: 1, active_metrics: 0, metrics_missing_requirements: 2 }
]
)
end
end
end
......
......@@ -81,7 +81,8 @@ RSpec.shared_examples 'additional metrics query' do
result: [
{
metric: {},
values: [[1488758662.506, '0.00002996364761904785'], [1488758722.506, '0.00003090239047619091']] }
values: [[1488758662.506, '0.00002996364761904785'], [1488758722.506, '0.00003090239047619091']]
}
]
}
]
......@@ -146,4 +147,4 @@ RSpec.shared_examples 'additional metrics query' do
end
end
end
end
\ No newline at end of file
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment