mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
The test setup is not threadsafe. Wrap in a mutex.
This commit is contained in:
parent
227cfe50c6
commit
1d55e07ff9
1 changed files with 7 additions and 3 deletions
|
@ -88,12 +88,16 @@ module ActiveSupport
|
||||||
!ENV["NO_FORK"] && ((RbConfig::CONFIG['host_os'] !~ /mswin|mingw/) && (RUBY_PLATFORM !~ /java/))
|
!ENV["NO_FORK"] && ((RbConfig::CONFIG['host_os'] !~ /mswin|mingw/) && (RUBY_PLATFORM !~ /java/))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@@class_setup_mutex = Mutex.new
|
||||||
|
|
||||||
def _run_class_setup # class setup method should only happen in parent
|
def _run_class_setup # class setup method should only happen in parent
|
||||||
|
@@class_setup_mutex.synchronize do
|
||||||
unless defined?(@@ran_class_setup) || ENV['ISOLATION_TEST']
|
unless defined?(@@ran_class_setup) || ENV['ISOLATION_TEST']
|
||||||
self.class.setup if self.class.respond_to?(:setup)
|
self.class.setup if self.class.respond_to?(:setup)
|
||||||
@@ran_class_setup = true
|
@@ran_class_setup = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def run(runner)
|
def run(runner)
|
||||||
_run_class_setup
|
_run_class_setup
|
||||||
|
|
Loading…
Reference in a new issue