2021-12-11 22:18:48 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# With the usage of `describe '...', query_analyzers: false`
|
|
|
|
# can be disabled selectively
|
|
|
|
|
|
|
|
RSpec.configure do |config|
|
2022-01-26 12:08:38 +05:30
|
|
|
config.before do |example|
|
2021-12-11 22:18:48 +05:30
|
|
|
if example.metadata.fetch(:query_analyzers, true)
|
2022-07-16 23:28:13 +05:30
|
|
|
::Gitlab::Database::QueryAnalyzer.instance.begin!(
|
|
|
|
::Gitlab::Database::QueryAnalyzer.instance.all_analyzers
|
|
|
|
)
|
2022-01-26 12:08:38 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
config.after do |example|
|
|
|
|
if example.metadata.fetch(:query_analyzers, true)
|
2022-07-16 23:28:13 +05:30
|
|
|
::Gitlab::Database::QueryAnalyzer.instance.end!(
|
|
|
|
::Gitlab::Database::QueryAnalyzer.instance.all_analyzers
|
|
|
|
)
|
2021-12-11 22:18:48 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|