123456789_123456789_123456789_123456789_123456789_

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

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Inherits: Object
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 Attribute Summary

Instance Method Summary

Instance Attribute Details

#pending?Boolean (readonly)

Check if there is pending work.

Returns:

  • (Boolean)

    true if work is pending

Raises:

  • (NotImplementedError)
[ GitHub ]

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

def pending?
  raise NotImplementedError
end

Instance Method Details

#add_test(test)

Add a test to be distributed to workers.

Parameters:

  • test (Array)

    Test tuple: [class, method, reporter]

Raises:

  • (NotImplementedError)
[ GitHub ]

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

def add_test(test)
  raise NotImplementedError
end

#close

Close the distributor. No more work will be accepted.

[ GitHub ]

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

def close
  # Optional
end

#interrupt

Clear all pending work (called on interrupt).

[ GitHub ]

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

def interrupt
  # Optional
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)
[ GitHub ]

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

def take(worker_id:)
  raise NotImplementedError
end