diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/lib/gitlab/health_checks | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/lib/gitlab/health_checks')
11 files changed, 25 insertions, 11 deletions
diff --git a/spec/lib/gitlab/health_checks/db_check_spec.rb b/spec/lib/gitlab/health_checks/db_check_spec.rb index 3c1c1e3818d..60ebc596a0f 100644 --- a/spec/lib/gitlab/health_checks/db_check_spec.rb +++ b/spec/lib/gitlab/health_checks/db_check_spec.rb @@ -3,6 +3,6 @@ require 'spec_helper' require_relative './simple_check_shared' -describe Gitlab::HealthChecks::DbCheck do +RSpec.describe Gitlab::HealthChecks::DbCheck do include_examples 'simple_check', 'db_ping', 'Db', '1' end diff --git a/spec/lib/gitlab/health_checks/gitaly_check_spec.rb b/spec/lib/gitlab/health_checks/gitaly_check_spec.rb index d4ce16ce6fc..7c346e3eb69 100644 --- a/spec/lib/gitlab/health_checks/gitaly_check_spec.rb +++ b/spec/lib/gitlab/health_checks/gitaly_check_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::HealthChecks::GitalyCheck do +RSpec.describe Gitlab::HealthChecks::GitalyCheck do let(:result_class) { Gitlab::HealthChecks::Result } let(:repository_storages) { ['default'] } diff --git a/spec/lib/gitlab/health_checks/master_check_spec.rb b/spec/lib/gitlab/health_checks/master_check_spec.rb index dcfc733d5ad..1c1efe178e2 100644 --- a/spec/lib/gitlab/health_checks/master_check_spec.rb +++ b/spec/lib/gitlab/health_checks/master_check_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require_relative './simple_check_shared' -describe Gitlab::HealthChecks::MasterCheck do +RSpec.describe Gitlab::HealthChecks::MasterCheck do let(:result_class) { Gitlab::HealthChecks::Result } before do diff --git a/spec/lib/gitlab/health_checks/probes/collection_spec.rb b/spec/lib/gitlab/health_checks/probes/collection_spec.rb index d8c411fa27b..03138e936aa 100644 --- a/spec/lib/gitlab/health_checks/probes/collection_spec.rb +++ b/spec/lib/gitlab/health_checks/probes/collection_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::HealthChecks::Probes::Collection do +RSpec.describe Gitlab::HealthChecks::Probes::Collection do let(:readiness) { described_class.new(*checks) } describe '#execute' do @@ -47,6 +47,20 @@ describe Gitlab::HealthChecks::Probes::Collection do status: 'failed', message: 'check error') end end + + context 'when check raises exception not handled inside the check' do + before do + expect(Gitlab::HealthChecks::Redis::RedisCheck).to receive(:readiness).and_raise( + ::Redis::CannotConnectError, 'Redis down') + end + + it 'responds with failure including the exception info' do + expect(subject.http_status).to eq(500) + + expect(subject.json[:status]).to eq('failed') + expect(subject.json[:message]).to eq('Redis::CannotConnectError : Redis down') + end + end end context 'without checks' do diff --git a/spec/lib/gitlab/health_checks/puma_check_spec.rb b/spec/lib/gitlab/health_checks/puma_check_spec.rb index 93ef81978a8..0bd0965518f 100644 --- a/spec/lib/gitlab/health_checks/puma_check_spec.rb +++ b/spec/lib/gitlab/health_checks/puma_check_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::HealthChecks::PumaCheck do +RSpec.describe Gitlab::HealthChecks::PumaCheck do let(:result_class) { Gitlab::HealthChecks::Result } let(:readiness) { described_class.readiness } let(:metrics) { described_class.metrics } diff --git a/spec/lib/gitlab/health_checks/redis/cache_check_spec.rb b/spec/lib/gitlab/health_checks/redis/cache_check_spec.rb index aaf474d7eeb..c44bd2ed585 100644 --- a/spec/lib/gitlab/health_checks/redis/cache_check_spec.rb +++ b/spec/lib/gitlab/health_checks/redis/cache_check_spec.rb @@ -3,6 +3,6 @@ require 'spec_helper' require_relative '../simple_check_shared' -describe Gitlab::HealthChecks::Redis::CacheCheck do +RSpec.describe Gitlab::HealthChecks::Redis::CacheCheck do include_examples 'simple_check', 'redis_cache_ping', 'RedisCache', 'PONG' end diff --git a/spec/lib/gitlab/health_checks/redis/queues_check_spec.rb b/spec/lib/gitlab/health_checks/redis/queues_check_spec.rb index f4b5e18da2a..3882e7db9d9 100644 --- a/spec/lib/gitlab/health_checks/redis/queues_check_spec.rb +++ b/spec/lib/gitlab/health_checks/redis/queues_check_spec.rb @@ -3,6 +3,6 @@ require 'spec_helper' require_relative '../simple_check_shared' -describe Gitlab::HealthChecks::Redis::QueuesCheck do +RSpec.describe Gitlab::HealthChecks::Redis::QueuesCheck do include_examples 'simple_check', 'redis_queues_ping', 'RedisQueues', 'PONG' end diff --git a/spec/lib/gitlab/health_checks/redis/redis_check_spec.rb b/spec/lib/gitlab/health_checks/redis/redis_check_spec.rb index ae7ee0d0859..43e890a6c4f 100644 --- a/spec/lib/gitlab/health_checks/redis/redis_check_spec.rb +++ b/spec/lib/gitlab/health_checks/redis/redis_check_spec.rb @@ -3,6 +3,6 @@ require 'spec_helper' require_relative '../simple_check_shared' -describe Gitlab::HealthChecks::Redis::RedisCheck do +RSpec.describe Gitlab::HealthChecks::Redis::RedisCheck do include_examples 'simple_check', 'redis_ping', 'Redis', 'PONG' end diff --git a/spec/lib/gitlab/health_checks/redis/shared_state_check_spec.rb b/spec/lib/gitlab/health_checks/redis/shared_state_check_spec.rb index 3e92b072254..25917741a1c 100644 --- a/spec/lib/gitlab/health_checks/redis/shared_state_check_spec.rb +++ b/spec/lib/gitlab/health_checks/redis/shared_state_check_spec.rb @@ -3,6 +3,6 @@ require 'spec_helper' require_relative '../simple_check_shared' -describe Gitlab::HealthChecks::Redis::SharedStateCheck do +RSpec.describe Gitlab::HealthChecks::Redis::SharedStateCheck do include_examples 'simple_check', 'redis_shared_state_ping', 'RedisSharedState', 'PONG' end diff --git a/spec/lib/gitlab/health_checks/simple_check_shared.rb b/spec/lib/gitlab/health_checks/simple_check_shared.rb index 3d0f9b3cf7a..591a11d5ab6 100644 --- a/spec/lib/gitlab/health_checks/simple_check_shared.rb +++ b/spec/lib/gitlab/health_checks/simple_check_shared.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -shared_context 'simple_check' do |metrics_prefix, check_name, success_result| +RSpec.shared_context 'simple_check' do |metrics_prefix, check_name, success_result| describe '#metrics' do subject { described_class.metrics } diff --git a/spec/lib/gitlab/health_checks/unicorn_check_spec.rb b/spec/lib/gitlab/health_checks/unicorn_check_spec.rb index 7c57b6f1ca5..1cc44016002 100644 --- a/spec/lib/gitlab/health_checks/unicorn_check_spec.rb +++ b/spec/lib/gitlab/health_checks/unicorn_check_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::HealthChecks::UnicornCheck do +RSpec.describe Gitlab::HealthChecks::UnicornCheck do let(:result_class) { Gitlab::HealthChecks::Result } let(:readiness) { described_class.readiness } let(:metrics) { described_class.metrics } |