diff options
author | rpereira2 <rpereira@gitlab.com> | 2019-04-02 20:43:36 +0530 |
---|---|---|
committer | Peter Leitzen <pleitzen@gitlab.com> | 2019-04-04 22:22:44 +0200 |
commit | f71d243a6d7fc0675b0b3fc9e35f9523d8dcb145 (patch) | |
tree | e5aff0301e295cc72ef47bb43de1ff546d8be0d5 | |
parent | 6938977a0a2e2cf7c1916f92fb9d8e2119b73e3c (diff) | |
download | gitlab-ce-f71d243a6d7fc0675b0b3fc9e35f9523d8dcb145.tar.gz |
Remove all superfluous braces
-rw-r--r-- | app/services/prometheus/proxy_service.rb | 1 | ||||
-rw-r--r-- | spec/services/prometheus/proxy_service_spec.rb | 22 |
2 files changed, 11 insertions, 12 deletions
diff --git a/app/services/prometheus/proxy_service.rb b/app/services/prometheus/proxy_service.rb index bd2f72df64d..dccad287720 100644 --- a/app/services/prometheus/proxy_service.rb +++ b/app/services/prometheus/proxy_service.rb @@ -61,7 +61,6 @@ module Prometheus response = prometheus_client_wrapper.proxy(path, params) success(http_status: response.code, body: response.body) - rescue Gitlab::PrometheusClient::Error => err service_unavailable_response(err) end diff --git a/spec/services/prometheus/proxy_service_spec.rb b/spec/services/prometheus/proxy_service_spec.rb index 391a108c862..1291c7a0217 100644 --- a/spec/services/prometheus/proxy_service_spec.rb +++ b/spec/services/prometheus/proxy_service_spec.rb @@ -9,7 +9,7 @@ describe Prometheus::ProxyService do set(:environment) { create(:environment, project: project) } describe '#initialize' do - let(:params) { ActionController::Parameters.new({ query: '1' }).permit! } + let(:params) { ActionController::Parameters.new(query: '1').permit! } it 'initializes attributes' do result = described_class.new(environment, 'GET', 'query', { query: '1' }) @@ -17,7 +17,7 @@ describe Prometheus::ProxyService do expect(result.prometheus_owner).to eq(environment) expect(result.method).to eq('GET') expect(result.path).to eq('query') - expect(result.params).to eq({ query: '1' }) + expect(result.params).to eq(query: '1') end it 'converts ActionController::Parameters into hash' do @@ -38,11 +38,11 @@ describe Prometheus::ProxyService do end it 'should return error' do - expect(subject.execute).to eq({ + expect(subject.execute).to eq( status: :error, message: 'No prometheus server found', http_status: :service_unavailable - }) + ) end end @@ -53,11 +53,11 @@ describe Prometheus::ProxyService do end it 'should return error' do - expect(subject.execute).to eq({ + expect(subject.execute).to eq( status: :error, message: 'No prometheus server found', http_status: :service_unavailable - }) + ) end end @@ -65,10 +65,10 @@ describe Prometheus::ProxyService do subject { described_class.new(environment, 'POST', 'query', { query: '1' }) } it 'returns error' do - expect(subject.execute).to eq({ + expect(subject.execute).to eq( message: 'Proxy support for this API is not available currently', status: :error - }) + ) end end @@ -159,11 +159,11 @@ describe Prometheus::ProxyService do end it 'returns error' do - expect(subject.execute).to eq({ + expect(subject.execute).to eq( status: :error, message: 'Network connection error', http_status: :service_unavailable - }) + ) end end end @@ -178,7 +178,7 @@ describe Prometheus::ProxyService do expect(result.prometheus_owner).to eq(environment) expect(result.method).to eq('GET') expect(result.path).to eq('query') - expect(result.params).to eq({ query: '1' }) + expect(result.params).to eq(query: '1') end end end |