diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /spec/spec_helper.rb | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r-- | spec/spec_helper.rb | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c8664598691..25759ca50b8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -107,9 +107,7 @@ RSpec.configure do |config| warn `curl -s -o log/goroutines.log http://localhost:9236/debug/pprof/goroutine?debug=2` end end - end - - unless ENV['CI'] + else # Allow running `:focus` examples locally, # falling back to all tests when there is no `:focus` example. config.filter_run focus: true @@ -199,6 +197,14 @@ RSpec.configure do |config| if ENV['CI'] || ENV['RETRIES'] # This includes the first try, i.e. tests will be run 4 times before failing. config.default_retry_count = ENV.fetch('RETRIES', 3).to_i + 1 + + # Do not retry controller tests because rspec-retry cannot properly + # reset the controller which may contain data from last attempt. See + # https://gitlab.com/gitlab-org/gitlab/-/merge_requests/73360 + config.prepend_before(:each, type: :controller) do |example| + example.metadata[:retry] = 1 + end + config.exceptions_to_hard_fail = [DeprecationToolkitEnv::DeprecationBehaviors::SelectiveRaise::RaiseDisallowedDeprecation] end @@ -232,7 +238,7 @@ RSpec.configure do |config| # We can't use an `around` hook here because the wrapping transaction # is not yet opened at the time that is triggered config.prepend_before do - Gitlab::Database.main.set_open_transactions_baseline + ApplicationRecord.set_open_transactions_baseline end config.append_before do @@ -240,7 +246,7 @@ RSpec.configure do |config| end config.append_after do - Gitlab::Database.main.reset_open_transactions_baseline + ApplicationRecord.reset_open_transactions_baseline end config.before do |example| @@ -431,6 +437,10 @@ RSpec.configure do |config| Gitlab::Metrics.reset_registry! end + config.before(:example, :eager_load) do + Rails.application.eager_load! + end + # This makes sure the `ApplicationController#can?` method is stubbed with the # original implementation for all view specs. config.before(:each, type: :view) do |