diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 23:02:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 23:02:30 +0300 |
commit | 41fe97390ceddf945f3d967b8fdb3de4c66b7dea (patch) | |
tree | 9c8d89a8624828992f06d892cd2f43818ff5dcc8 /spec/spec_helper.rb | |
parent | 0804d2dc31052fb45a1efecedc8e06ce9bc32862 (diff) |
Add latest changes from gitlab-org/gitlab@14-9-stable-eev14.9.0-rc42
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r-- | spec/spec_helper.rb | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 37e9ef1d994..a72c8d2c4e8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -199,6 +199,7 @@ RSpec.configure do |config| config.include SidekiqMiddleware config.include StubActionCableConnection, type: :channel config.include StubSpamServices + config.include RSpec::Benchmark::Matchers, type: :benchmark include StubFeatureFlags @@ -252,6 +253,20 @@ RSpec.configure do |config| ::Ci::ApplicationRecord.set_open_transactions_baseline end + config.around do |example| + if example.metadata.fetch(:stub_feature_flags, true) + # It doesn't make sense for this to default to enabled as we only plan to + # use this temporarily to override an environment variable but eventually + # we'll just use the environment variable value when we've completed the + # gradual rollout. This stub must happen in around block as there are other + # around blocks in tests that will run before this and get the wrong + # database connection. + stub_feature_flags(force_no_sharing_primary_model: false) + end + + example.run + end + config.append_after do ApplicationRecord.reset_open_transactions_baseline ::Ci::ApplicationRecord.reset_open_transactions_baseline @@ -304,8 +319,6 @@ RSpec.configure do |config| # As we're ready to change `master` usages to `main`, let's enable it stub_feature_flags(main_branch_over_master: false) - stub_feature_flags(issue_boards_filtered_search: false) - # Disable issue respositioning to avoid heavy load on database when importing big projects. # This is only turned on when app is handling heavy project imports. # Can be removed when we find a better way to deal with the problem. @@ -445,11 +458,6 @@ RSpec.configure do |config| end end - # Allows stdout to be redirected to reduce noise - config.before(:each, :silence_stdout) do - $stdout = StringIO.new - end - # Makes diffs show entire non-truncated values. config.before(:each, unlimited_max_formatted_output_length: true) do |_example| config.expect_with :rspec do |c| @@ -462,10 +470,6 @@ RSpec.configure do |config| allow_any_instance_of(VersionCheck).to receive(:response).and_return({ "severity" => "success" }) end - config.after(:each, :silence_stdout) do - $stdout = STDOUT - end - config.disable_monkey_patching! end |