summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-10-06 18:08:09 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-10-06 18:08:09 +0000
commit1287690a3678ad0ec21c9b2f3b21ae18257d5e22 (patch)
tree96162972275004dcaef6376fe324ee2a7a549833 /lib
parentd4806ad7dbd2d87ae09872709fef1aef35792e21 (diff)
downloadgitlab-ce-1287690a3678ad0ec21c9b2f3b21ae18257d5e22.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/database/query_analyzers/base.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/gitlab/database/query_analyzers/base.rb b/lib/gitlab/database/query_analyzers/base.rb
index 5f321ece962..9a52a4f6e23 100644
--- a/lib/gitlab/database/query_analyzers/base.rb
+++ b/lib/gitlab/database/query_analyzers/base.rb
@@ -8,7 +8,7 @@ module Gitlab
QueryAnalyzerError = Class.new(Exception) # rubocop:disable Lint/InheritException
def self.suppressed?
- Thread.current[self.suppress_key]
+ Thread.current[self.suppress_key] || @suppress_in_rspec
end
def self.requires_tracking?(parsed)
@@ -19,6 +19,20 @@ module Gitlab
Thread.current[self.suppress_key] = value
end
+ # The other suppress= method stores the
+ # value in Thread.current because it is
+ # meant to work in a multi-threaded puma
+ # environment but this does not work
+ # correctly in capybara tests where we
+ # suppress in the rspec runner context but
+ # this does not take effect in the puma
+ # thread. As such we just suppress
+ # globally in RSpec since we don't run
+ # different tests concurrently.
+ class << self
+ attr_writer :suppress_in_rspec
+ end
+
def self.with_suppressed(value = true, &blk)
previous = self.suppressed?
self.suppress = value