Fix rubocop warnings

This commit is contained in:
Pawel Chojnacki 2018-01-04 17:11:39 +01:00
parent 09473b192c
commit 57c1f7cae0
4 changed files with 19 additions and 13 deletions

View file

@ -45,7 +45,8 @@ class PrometheusService < MonitoringService
def fields
[
{ type: 'fieldset',
{
type: 'fieldset',
legend: 'Manual Configuration',
fields: [
{
@ -100,6 +101,7 @@ class PrometheusService < MonitoringService
# Cache metrics for specific environment
def calculate_reactive_cache(query_class_name, environment_id, *args)
return unless active? && project && !project.pending_delete?
client = client(environment_id)
data = Kernel.const_get(query_class_name).new(client).query(environment_id, *args)
@ -118,9 +120,10 @@ class PrometheusService < MonitoringService
else
cluster = cluster_with_prometheus(environment_id)
raise Gitlab::PrometheusError, "couldn't find cluster with Prometheus installed" unless cluster
rest_client = client_from_cluster(cluster)
rest_client = client_from_cluster(cluster)
raise Gitlab::PrometheusError, "couldn't create proxy Prometheus client" unless rest_client
Gitlab::PrometheusClient.new(rest_client)
end
end

View file

@ -51,13 +51,16 @@ describe Clusters::Applications::Prometheus do
context 'cluster has kubeclient' do
let(:kubernetes_url) { 'http://example.com' }
let(:k8s_discover_response) { {
let(:k8s_discover_response) do
{
resources: [
{
name: 'service',
kind: 'Service'
}]
} }
}
]
}
end
let(:kube_client) { Kubeclient::Client.new(kubernetes_url) }