Project

General

Profile

Patch #44116 » 0001-Enable-parallel-tests-only-in-test-workflow.patch

Katsuya HIDAKA, 2026-06-02 09:13

View differences:

.github/workflows/tests.yml
52 52
          db-type: ${{ matrix.db }}
53 53
          ruby-version: ${{ matrix.ruby }}
54 54

  
55
      - name: Enable parallel tests
56
        run: echo "PARALLEL_WORKERS=$(nproc)" >> $GITHUB_ENV
57

  
55 58
      - name: Run tests
56 59
        run: |
57 60
          bin/rails test
doc/RUNNING_TESTS
14 14
You can run `ruby test/unit/issue_test.rb` for running a single test case and
15 15
`ruby test/unit/issue_test.rb -n test_create` for running a single test.
16 16

  
17
Tests run in parallel by default, using the number of processors as the worker
18
count. You can change the worker count by setting the PARALLEL_WORKERS
19
environment variable:
17
You can run tests in parallel by setting the PARALLEL_WORKERS environment
18
variable:
20 19
`PARALLEL_WORKERS=8 bin/rails test`
21 20

  
22 21
Before running tests, you need to configure both development
test/application_system_test_case.rb
20 20
require_relative 'test_helper'
21 21

  
22 22
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
23
  parallelize(workers: 1)
24

  
25 23
  DOWNLOADS_PATH = File.expand_path(File.join(Rails.root, 'tmp', 'downloads'))
26 24

  
27 25
  # Allow running Capybara default server on custom IP address and/or port
test/test_helper.rb
50 50
end
51 51

  
52 52
class ActiveSupport::TestCase
53
  parallelize(workers: :number_of_processors)
53
  parallelize(workers: 1)
54 54

  
55 55
  include ActionDispatch::TestProcess
56 56

  
(4-4/4)