diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 21:38:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 21:38:24 +0300 |
commit | 983a0bba5d2a042c4a3bbb22432ec192c7501d82 (patch) | |
tree | b153cd387c14ba23bd5a07514c7c01fddf6a78a0 /spec/support/sidekiq_middleware.rb | |
parent | a2bddee2cdb38673df0e004d5b32d9f77797de64 (diff) |
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'spec/support/sidekiq_middleware.rb')
-rw-r--r-- | spec/support/sidekiq_middleware.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/spec/support/sidekiq_middleware.rb b/spec/support/sidekiq_middleware.rb index f6694713101..1380f4394d8 100644 --- a/spec/support/sidekiq_middleware.rb +++ b/spec/support/sidekiq_middleware.rb @@ -2,6 +2,17 @@ require 'sidekiq/testing' +# rubocop:disable RSpec/ModifySidekiqMiddleware +module SidekiqMiddleware + def with_sidekiq_server_middleware(&block) + Sidekiq::Testing.server_middleware.clear + Sidekiq::Testing.server_middleware(&block) + ensure + Sidekiq::Testing.server_middleware.clear + end +end +# rubocop:enable RSpec/ModifySidekiqMiddleware + # If Sidekiq::Testing.inline! is used, SQL transactions done inside # Sidekiq worker are included in the SQL query limit (in a real # deployment sidekiq worker is executed separately). To avoid @@ -20,8 +31,3 @@ class DisableQueryLimit end end end - -Sidekiq::Testing.server_middleware do |chain| - chain.add Gitlab::SidekiqStatus::ServerMiddleware - chain.add DisableQueryLimit -end |