A platform for community discussion. Free, open, simple.
DEV: Add a per-spec timeout (#21648)
Jarek Radosz928d608ce7d8
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rbindex 6017ec4dc14..6e61d24b9cb 100644--- a/spec/rails_helper.rb+++ b/spec/rails_helper.rb@@ -163,6 +163,8 @@ elseTestProf::LetItBe.configure { |config| config.alias_to :fab!, refind: true }end+PER_SPEC_TIMEOUT_SECONDS = 30+RSpec.configure do |config|config.fail_fast = ENV["RSPEC_FAIL_FAST"] == "1"config.silence_filter_announcements = ENV["RSPEC_SILENCE_FILTER_ANNOUNCEMENTS"] == "1"@@ -368,6 +370,16 @@ RSpec.configure do |config|"DiscourseEvent registrations were not cleaned up"end+ if ENV["CI"]+ config.around do |example|+ Timeout.timeout(+ PER_SPEC_TIMEOUT_SECONDS,+ nil,+ "Spec timed out after #{PER_SPEC_TIMEOUT_SECONDS} seconds",+ ) { example.run }+ end+ end+config.before :each do# This allows DB.transaction_open? to work in tests. See lib/mini_sql_multisite_connection.rbDB.test_transaction = ActiveRecord::Base.connection.current_transaction