class ActiveSupport::TestCase
def parallelize(workers: :number_of_processors, with: :processes, threshold: ActiveSupport.test_parallelization_threshold)
Experimental RBS support (using type sampling data from the type_fusion
project).
def parallelize: (workers: Integer, with: Symbol, threshold: Integer) -> ActiveSupport::Testing::ParallelizeExecutor
This signature was generated using 3 samples from 1 application.
number of tests to run is above the +threshold+ param. The default value is
Because parallelization presents an overhead, it is only enabled when the
The processes parallelization uses a Ruby DRb server.
The threaded parallelization uses minitest's parallel executor directly.
parallelize(workers: :number_of_processors, with: :threads)
database and will not work with system tests at this time.
method. Note the threaded parallelization does not create multiple
use threads instead you can pass with: :threads to the +parallelize+
The default parallelization method is to fork processes. If you'd like to
set to the actual core count on the machine you are on.
If +workers+ is set to +:number_of_processors+, the number of workers will be
parallelized.
If the number of workers is set to +1+ or fewer, the tests will not be
you do for local testing.
environments, or other environments where you may need more workers than
and the environment variable will be used instead. This is useful for CI
If ENV["PARALLEL_WORKERS"] is set the workers argument will be ignored
test-database-1
test-database-0
with the worker number.
is forked. For each process a new database will be created suffixed
Takes a +workers+ argument that controls how many times the process
Parallelizes the test suite.
def parallelize(workers: :number_of_processors, with: :processes, threshold: ActiveSupport.test_parallelization_threshold) workers = Concurrent.physical_processor_count if workers == :number_of_processors workers = ENV["PARALLEL_WORKERS"].to_i if ENV["PARALLEL_WORKERS"] return if workers <= 1 Minitest.parallel_executor = ActiveSupport::Testing::ParallelizeExecutor.new(size: workers, with: with, threshold: threshold) end