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:
Diffstat (limited to 'spec/lib/gitlab/health_checks/db_check_spec.rb')
-rw-r--r--spec/lib/gitlab/health_checks/db_check_spec.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/spec/lib/gitlab/health_checks/db_check_spec.rb b/spec/lib/gitlab/health_checks/db_check_spec.rb
index 60ebc596a0f..09b2650eae8 100644
--- a/spec/lib/gitlab/health_checks/db_check_spec.rb
+++ b/spec/lib/gitlab/health_checks/db_check_spec.rb
@@ -4,5 +4,20 @@ require 'spec_helper'
require_relative './simple_check_shared'
RSpec.describe Gitlab::HealthChecks::DbCheck do
- include_examples 'simple_check', 'db_ping', 'Db', '1'
+ include_examples 'simple_check', 'db_ping', 'Db', Gitlab::Database.database_base_models.size
+
+ context 'with multiple databases' do
+ subject { described_class.readiness }
+
+ before do
+ allow(Gitlab::Database).to receive(:database_base_models)
+ .and_return({ main: ApplicationRecord, ci: Ci::ApplicationRecord }.with_indifferent_access)
+ end
+
+ it 'checks multiple databases' do
+ expect(ApplicationRecord.connection).to receive(:select_value).with('SELECT 1').and_call_original
+ expect(Ci::ApplicationRecord.connection).to receive(:select_value).with('SELECT 1').and_call_original
+ expect(subject).to have_attributes(success: true)
+ end
+ end
end