Class: ActiveSupport::Testing::Parallelization::TestDistributor

Inherits:
Object
  • Object
show all
Defined in:
activesupport/lib/active_support/testing/parallelization/test_distributor.rb

Overview

Abstract base class for test distribution strategies. Subclasses implement different ways of assigning tests to workers.

Instance Method Summary collapse

Instance Method Details

#add_test(test) ⇒ Object

Add a test to be distributed to workers.

Parameters:

  • test (Array)

    Test tuple: [class, method, reporter]

Raises:

  • (NotImplementedError)


11
12
13
# File 'activesupport/lib/active_support/testing/parallelization/test_distributor.rb', line 11

def add_test(test)
  raise NotImplementedError
end

#closeObject

Close the distributor. No more work will be accepted.



34
35
36
# File 'activesupport/lib/active_support/testing/parallelization/test_distributor.rb', line 34

def close
  # Optional
end

#interruptObject

Clear all pending work (called on interrupt).



23
24
25
# File 'activesupport/lib/active_support/testing/parallelization/test_distributor.rb', line 23

def interrupt
  # Optional
end

#pending?Boolean

Check if there is pending work.

Returns:

  • (Boolean)

    true if work is pending

Raises:

  • (NotImplementedError)


29
30
31
# File 'activesupport/lib/active_support/testing/parallelization/test_distributor.rb', line 29

def pending?
  raise NotImplementedError
end

#take(worker_id:) ⇒ Array?

Retrieve the next test for a specific worker.

Parameters:

  • worker_id (Integer)

    The worker requesting work

Returns:

  • (Array, nil)

    Test tuple or nil if no work available

Raises:

  • (NotImplementedError)


18
19
20
# File 'activesupport/lib/active_support/testing/parallelization/test_distributor.rb', line 18

def take(worker_id:)
  raise NotImplementedError
end