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>2022-09-20 02:18:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-20 02:18:09 +0300
commit6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch)
treedc4d20fe6064752c0bd323187252c77e0a89144b /spec/requests/health_controller_spec.rb
parent9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff)
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'spec/requests/health_controller_spec.rb')
-rw-r--r--spec/requests/health_controller_spec.rb22
1 files changed, 18 insertions, 4 deletions
diff --git a/spec/requests/health_controller_spec.rb b/spec/requests/health_controller_spec.rb
index f70faf5bb9c..ae15b63df19 100644
--- a/spec/requests/health_controller_spec.rb
+++ b/spec/requests/health_controller_spec.rb
@@ -127,6 +127,10 @@ RSpec.describe HealthController do
end
it 'responds with readiness checks data' do
+ expect_next_instance_of(Gitlab::GitalyClient::ServerService) do |service|
+ expect(service).to receive(:readiness_check).and_return({ success: true })
+ end
+
subject
expect(json_response['db_check']).to contain_exactly({ 'status' => 'ok' })
@@ -138,19 +142,29 @@ RSpec.describe HealthController do
end
it 'responds with readiness checks data when a failure happens' do
- allow(Gitlab::HealthChecks::Redis::RedisCheck).to receive(:readiness).and_return(
- Gitlab::HealthChecks::Result.new('redis_check', false, "check error"))
+ allow(Gitlab::HealthChecks::Redis::SharedStateCheck).to receive(:readiness).and_return(
+ Gitlab::HealthChecks::Result.new('shared_state_check', false, "check error"))
subject
expect(json_response['cache_check']).to contain_exactly({ 'status' => 'ok' })
- expect(json_response['redis_check']).to contain_exactly(
+ expect(json_response['shared_state_check']).to contain_exactly(
{ 'status' => 'failed', 'message' => 'check error' })
expect(response).to have_gitlab_http_status(:service_unavailable)
expect(response.headers['X-GitLab-Custom-Error']).to eq(1)
end
+ it 'checks all redis instances' do
+ expected_redis_checks = Gitlab::Redis::ALL_CLASSES.map do |redis|
+ { "#{redis.store_name.underscore}_check" => [{ 'status' => 'ok' }] }
+ end
+
+ subject
+
+ expect(json_response).to include(*expected_redis_checks)
+ end
+
context 'when DB is not accessible and connection raises an exception' do
before do
expect(Gitlab::HealthChecks::DbCheck)
@@ -170,7 +184,7 @@ RSpec.describe HealthController do
context 'when any exception happens during the probing' do
before do
- expect(Gitlab::HealthChecks::Redis::RedisCheck)
+ expect(Gitlab::HealthChecks::Redis::CacheCheck)
.to receive(:readiness)
.and_raise(::Redis::CannotConnectError, 'Redis down')
end