Commit f45171bc authored by Kamil Trzciński's avatar Kamil Trzciński Committed by Adam Hegyi

Register `QueryAnalayzers` in `config.before` to fix `let_it_be`

parent 21fc0769
......@@ -67,8 +67,6 @@ module Gitlab
end
end
private
# Enable query analyzers
def begin!
analyzers = all_analyzers.select do |analyzer|
......@@ -97,6 +95,8 @@ module Gitlab
Thread.current[:query_analyzer_enabled_analyzers] = nil
end
private
def enabled_analyzers
Thread.current[:query_analyzer_enabled_analyzers]
end
......
......@@ -4,11 +4,15 @@
# can be disabled selectively
RSpec.configure do |config|
config.around do |example|
config.before do |example|
if example.metadata.fetch(:query_analyzers, true)
::Gitlab::Database::QueryAnalyzer.instance.within { example.run }
else
example.run
::Gitlab::Database::QueryAnalyzer.instance.begin!
end
end
config.after do |example|
if example.metadata.fetch(:query_analyzers, true)
::Gitlab::Database::QueryAnalyzer.instance.end!
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment