Class: CI::Queue::Bisect
- Inherits:
-
Object
- Object
- CI::Queue::Bisect
- Defined in:
- lib/ci/queue/bisect.rb
Instance Method Summary collapse
- #candidates ⇒ Object
- #failed! ⇒ Object
- #failing_test ⇒ Object
- #failing_test_present? ⇒ Boolean
-
#initialize(path, config) ⇒ Bisect
constructor
A new instance of Bisect.
- #populate(all_tests, random: nil) ⇒ Object
- #release! ⇒ Object
- #size ⇒ Object
- #succeeded! ⇒ Object
- #suspects_left ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(path, config) ⇒ Bisect
Returns a new instance of Bisect.
5 6 7 8 |
# File 'lib/ci/queue/bisect.rb', line 5 def initialize(path, config) @tests = ::File.readlines(path).map(&:strip).reject(&:empty?).take_while { |t| t != config.failing_test } @config = config end |
Instance Method Details
#candidates ⇒ Object
34 35 36 |
# File 'lib/ci/queue/bisect.rb', line 34 def candidates Static.new(first_half + [config.failing_test], config).populate(@all_tests) end |
#failed! ⇒ Object
42 43 44 |
# File 'lib/ci/queue/bisect.rb', line 42 def failed! @tests = first_half end |
#failing_test ⇒ Object
26 27 28 |
# File 'lib/ci/queue/bisect.rb', line 26 def failing_test Static.new([config.failing_test], config).populate(@all_tests) end |
#failing_test_present? ⇒ Boolean
30 31 32 |
# File 'lib/ci/queue/bisect.rb', line 30 def failing_test_present? @all_tests.find { |t| t.id == config.failing_test } end |
#populate(all_tests, random: nil) ⇒ Object
14 15 16 |
# File 'lib/ci/queue/bisect.rb', line 14 def populate(all_tests, random: nil) @all_tests = all_tests end |
#release! ⇒ Object
38 39 40 |
# File 'lib/ci/queue/bisect.rb', line 38 def release! # noop end |
#size ⇒ Object
10 11 12 |
# File 'lib/ci/queue/bisect.rb', line 10 def size @tests.size end |
#succeeded! ⇒ Object
46 47 48 |
# File 'lib/ci/queue/bisect.rb', line 46 def succeeded! @tests = second_half end |
#suspects_left ⇒ Object
22 23 24 |
# File 'lib/ci/queue/bisect.rb', line 22 def suspects_left @tests.size end |
#to_a ⇒ Object
18 19 20 |
# File 'lib/ci/queue/bisect.rb', line 18 def to_a @tests + [config.failing_test] end |