elastic/elasticsearch-rails

Use different indexes when executing parallel tests in rails 6

Closed this issue · 1 comments

Is it possible to use different indexes name for different testing executor when running rails 6 tests in parallel?

Thanks.

I answer on myself:

class ActiveSupport::TestCase
  # Run tests in parallel with specified workers
  parallelize(workers: :number_of_processors)

  parallelize_setup do |n|
    Model.index_name "model_test-#{n}"
    Model.create_index if !Ioc.index_exists
  end
end