Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-18 16:16:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-18 16:16:36 +0300
commit311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch)
tree07e7870bca8aed6d61fdcc810731c50d2c40af47 /spec/lib/gitlab/prometheus_client_spec.rb
parent27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff)
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'spec/lib/gitlab/prometheus_client_spec.rb')
-rw-r--r--spec/lib/gitlab/prometheus_client_spec.rb36
1 files changed, 7 insertions, 29 deletions
diff --git a/spec/lib/gitlab/prometheus_client_spec.rb b/spec/lib/gitlab/prometheus_client_spec.rb
index 82ef4675553..89ddde4a01d 100644
--- a/spec/lib/gitlab/prometheus_client_spec.rb
+++ b/spec/lib/gitlab/prometheus_client_spec.rb
@@ -107,36 +107,14 @@ RSpec.describe Gitlab::PrometheusClient do
let(:prometheus_url) {"https://prometheus.invalid.example.com/api/v1/query?query=1"}
shared_examples 'exceptions are raised' do
- it 'raises a Gitlab::PrometheusClient::ConnectionError error when a SocketError is rescued' do
- req_stub = stub_prometheus_request_with_exception(prometheus_url, SocketError)
+ Gitlab::HTTP::HTTP_ERRORS.each do |error|
+ it "raises a Gitlab::PrometheusClient::ConnectionError when a #{error} is rescued" do
+ req_stub = stub_prometheus_request_with_exception(prometheus_url, error.new)
- expect { subject }
- .to raise_error(Gitlab::PrometheusClient::ConnectionError, "Can't connect to #{prometheus_url}")
- expect(req_stub).to have_been_requested
- end
-
- it 'raises a Gitlab::PrometheusClient::ConnectionError error when a SSLError is rescued' do
- req_stub = stub_prometheus_request_with_exception(prometheus_url, OpenSSL::SSL::SSLError)
-
- expect { subject }
- .to raise_error(Gitlab::PrometheusClient::ConnectionError, "#{prometheus_url} contains invalid SSL data")
- expect(req_stub).to have_been_requested
- end
-
- it 'raises a Gitlab::PrometheusClient::ConnectionError error when a Gitlab::HTTP::ResponseError is rescued' do
- req_stub = stub_prometheus_request_with_exception(prometheus_url, Gitlab::HTTP::ResponseError)
-
- expect { subject }
- .to raise_error(Gitlab::PrometheusClient::ConnectionError, "Network connection error")
- expect(req_stub).to have_been_requested
- end
-
- it 'raises a Gitlab::PrometheusClient::ConnectionError error when a Gitlab::HTTP::ResponseError with a code is rescued' do
- req_stub = stub_prometheus_request_with_exception(prometheus_url, Gitlab::HTTP::ResponseError.new(code: 400))
-
- expect { subject }
- .to raise_error(Gitlab::PrometheusClient::ConnectionError, "Network connection error")
- expect(req_stub).to have_been_requested
+ expect { subject }
+ .to raise_error(Gitlab::PrometheusClient::ConnectionError, kind_of(String))
+ expect(req_stub).to have_been_requested
+ end
end
end