debian-mirror-gitlab/spec/lib/gitlab/health_checks/db_check_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
832 B
Ruby
Raw Normal View History

2020-01-01 13:55:28 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
require_relative './simple_check_shared'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::HealthChecks::DbCheck do
2022-05-07 20:08:51 +05:30
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
2017-08-17 22:00:37 +05:30
end