File: multiple_databases.rb

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (23 lines) | stat: -rw-r--r-- 838 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

RSpec.configure do |config|
  # Ensure database versions are memoized to prevent query counts from
  # being affected by version checks. Note that
  # Gitlab::Database.check_postgres_version_and_print_warning is called
  # at startup, but that generates its own
  # `Gitlab::Database::Reflection` so the result is not memoized by
  # callers of `ApplicationRecord.database.version`, such as
  [ApplicationRecord, ::Ci::ApplicationRecord].each { |record| record.database.version }

  config.around(:each, :reestablished_active_record_base) do |example|
    with_reestablished_active_record_base(reconnect: example.metadata.fetch(:reconnect, true)) do
      example.run
    end
  end

  config.around(:each, :add_ci_connection) do |example|
    with_added_ci_connection do
      example.run
    end
  end
end