Class: CI::Queue::Bisect

Inherits:
Object
  • Object
show all
Defined in:
lib/ci/queue/bisect.rb

Instance Method Summary collapse

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

#candidatesObject



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_testObject



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

Returns:

  • (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

#sizeObject



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_leftObject



22
23
24
# File 'lib/ci/queue/bisect.rb', line 22

def suspects_left
  @tests.size
end

#to_aObject



18
19
20
# File 'lib/ci/queue/bisect.rb', line 18

def to_a
  @tests + [config.failing_test]
end