spec/lite_spec_helper.rb in mongo-2.17.4 vs spec/lite_spec_helper.rb in mongo-2.18.0.beta1
- old
+ new
@@ -9,12 +9,10 @@
SERVER_DISCOVERY_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/sdam/**/*.yml").sort
SDAM_MONITORING_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/sdam_monitoring/*.yml").sort
SERVER_SELECTION_RTT_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/server_selection_rtt/*.yml").sort
CRUD_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/crud/**/*.yml").sort
CRUD2_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/crud_v2/**/*.yml").sort
-RETRYABLE_WRITES_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/retryable_writes/**/*.yml").sort
-RETRYABLE_READS_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/retryable_reads/**/*.yml").sort
COMMAND_MONITORING_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/command_monitoring/**/*.yml").sort
CONNECTION_STRING_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/connection_string/*.yml").sort
URI_OPTIONS_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/uri_options/*.yml").sort
GRIDFS_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/gridfs/*.yml").sort
TRANSACTIONS_TESTS = Dir.glob("#{CURRENT_PATH}/spec_tests/data/transactions/*.yml").sort
@@ -53,10 +51,12 @@
autoload :Benchmark, 'benchmark'
autoload :IceNine, 'ice_nine'
autoload :Timecop, 'timecop'
autoload :ChildProcess, 'childprocess'
+require 'rspec/retry'
+
if BSON::Environment.jruby?
require 'concurrent-ruby'
PossiblyConcurrentArray = Concurrent::Array
else
PossiblyConcurrentArray = Array
@@ -79,31 +79,37 @@
require 'support/matchers'
require 'mrss/event_subscriber'
require 'support/common_shortcuts'
require 'support/client_registry'
require 'support/client_registry_macros'
+require 'support/mongos_macros'
+require 'support/macros'
require 'support/crypt'
require 'support/json_ext_formatter'
require 'support/sdam_formatter_integration'
require 'support/background_thread_registry'
-require 'support/session_registry'
+require 'mrss/session_registry'
require 'support/local_resource_registry'
if SpecConfig.instance.mri?
require 'timeout_interrupt'
else
require 'timeout'
TimeoutInterrupt = Timeout
end
+Mrss.patch_mongo_for_session_registry
+
class ExampleTimeout < StandardError; end
RSpec.configure do |config|
config.extend(CommonShortcuts::ClassMethods)
config.include(CommonShortcuts::InstanceMethods)
config.extend(Mrss::LiteConstraints)
config.include(ClientRegistryMacros)
+ config.include(MongosMacros)
+ config.extend(Mongo::Macros)
if SpecConfig.instance.ci?
SdamFormatterIntegration.subscribe
config.add_formatter(JsonExtFormatter, File.join(File.dirname(__FILE__), '../tmp/rspec.json'))
@@ -116,17 +122,20 @@
end
end
end
if SpecConfig.instance.ci? && !%w(1 true yes).include?(ENV['INTERACTIVE']&.downcase)
- # Allow a max of 30 seconds per test.
# Tests should take under 10 seconds ideally but it seems
# we have some that run for more than 10 seconds in CI.
config.around(:each) do |example|
timeout = if %w(1 true yes).include?(ENV['STRESS']&.downcase)
210
else
- 45
+ if BSON::Environment.jruby?
+ 90
+ else
+ 45
+ end
end
TimeoutInterrupt.timeout(timeout, ExampleTimeout) do
example.run
end
end