From 6eb9e981c61969a904ccbae2c5f52f562b02d199 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Thu, 4 May 2017 09:16:24 -0500 Subject: [PATCH] Improved changelog entry, also changed error message for HTTParty error --- .../unreleased/prometheus-integration-test-setting-fix.yml | 2 +- lib/gitlab/prometheus.rb | 2 +- spec/lib/gitlab/prometheus_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/changelogs/unreleased/prometheus-integration-test-setting-fix.yml b/changelogs/unreleased/prometheus-integration-test-setting-fix.yml index c65c682a114..45b7c2263e6 100644 --- a/changelogs/unreleased/prometheus-integration-test-setting-fix.yml +++ b/changelogs/unreleased/prometheus-integration-test-setting-fix.yml @@ -1,4 +1,4 @@ --- -title: Added rescue block for the test method +title: Prevent 500 errors caused by testing the Prometheus service merge_request: 10994 author: diff --git a/lib/gitlab/prometheus.rb b/lib/gitlab/prometheus.rb index aa9810c5c41..8827507955d 100644 --- a/lib/gitlab/prometheus.rb +++ b/lib/gitlab/prometheus.rb @@ -55,7 +55,7 @@ module Gitlab rescue OpenSSL::SSL::SSLError raise PrometheusError, "#{url} contains invalid SSL data" rescue HTTParty::Error - raise PrometheusError, "An error has ocurred" + raise PrometheusError, "Network connection error" end def handle_response(response) diff --git a/spec/lib/gitlab/prometheus_spec.rb b/spec/lib/gitlab/prometheus_spec.rb index 8e187df6ca4..fc453a2704b 100644 --- a/spec/lib/gitlab/prometheus_spec.rb +++ b/spec/lib/gitlab/prometheus_spec.rb @@ -73,7 +73,7 @@ describe Gitlab::Prometheus, lib: true do req_stub = stub_prometheus_request_with_exception(prometheus_url, HTTParty::Error) expect { subject.send(:get, prometheus_url) } - .to raise_error(Gitlab::PrometheusError, "An error has ocurred") + .to raise_error(Gitlab::PrometheusError, "Network connection error") expect(req_stub).to have_been_requested end end -- GitLab