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>2020-03-26 03:07:58 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-26 03:07:58 +0300
commit101c30f4dffc624af3cbe3f12edc2cfee570a5f3 (patch)
treece7c63b2d73a42ad41d004020410871968974537 /spec/lib/gitlab
parente1549c75843d235607aebac9ed64f2fd10e549ed (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r--spec/lib/gitlab/prometheus_client_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/lib/gitlab/prometheus_client_spec.rb b/spec/lib/gitlab/prometheus_client_spec.rb
index 5eb133a5bf4..e869a384b29 100644
--- a/spec/lib/gitlab/prometheus_client_spec.rb
+++ b/spec/lib/gitlab/prometheus_client_spec.rb
@@ -16,6 +16,26 @@ describe Gitlab::PrometheusClient do
end
end
+ describe '#healthy?' do
+ it 'returns true when status code is 200 and healthy response body' do
+ stub_request(:get, subject.health_url).to_return(status: 200, body: described_class::HEALTHY_RESPONSE)
+
+ expect(subject.healthy?).to eq(true)
+ end
+
+ it 'returns false when status code is 200 and unhealthy response body' do
+ stub_request(:get, subject.health_url).to_return(status: 200, body: '')
+
+ expect(subject.healthy?).to eq(false)
+ end
+
+ it 'raises error when status code not 200' do
+ stub_request(:get, subject.health_url).to_return(status: 500, body: '')
+
+ expect { subject.healthy? }.to raise_error(Gitlab::PrometheusClient::Error)
+ end
+ end
+
# This shared examples expect:
# - query_url: A query URL
# - execute_query: A query call