class Knapsack::Distributors::BaseDistributor
Attributes
node_tests[R]
report[R]
test_file_pattern[R]
Public Class Methods
new(args={})
click to toggle source
# File lib/knapsack/distributors/base_distributor.rb, line 6 def initialize(args={}) @report = args[:report] || raise('Missing report') @test_file_pattern = args[:test_file_pattern] || raise('Missing test_file_pattern') @ci_node_total = args[:ci_node_total] || raise('Missing ci_node_total') @ci_node_index = args[:ci_node_index] || raise('Missing ci_node_index') if ci_node_index >= ci_node_total raise("Node indexes are 0-based. Can't be higher or equal to the total number of nodes.") end end
Public Instance Methods
all_tests()
click to toggle source
# File lib/knapsack/distributors/base_distributor.rb, line 39 def all_tests @all_tests ||= Dir.glob(test_file_pattern).uniq.sort end
assign_test_files_to_node()
click to toggle source
# File lib/knapsack/distributors/base_distributor.rb, line 34 def assign_test_files_to_node default_node_tests post_assign_test_files_to_node end
ci_node_index()
click to toggle source
# File lib/knapsack/distributors/base_distributor.rb, line 21 def ci_node_index @ci_node_index.to_i end
ci_node_total()
click to toggle source
# File lib/knapsack/distributors/base_distributor.rb, line 17 def ci_node_total @ci_node_total.to_i end
tests_for_current_node()
click to toggle source
# File lib/knapsack/distributors/base_distributor.rb, line 25 def tests_for_current_node tests_for_node(ci_node_index) end
tests_for_node(node_index)
click to toggle source
# File lib/knapsack/distributors/base_distributor.rb, line 29 def tests_for_node(node_index) assign_test_files_to_node post_tests_for_node(node_index) end
Protected Instance Methods
default_node_tests()
click to toggle source
# File lib/knapsack/distributors/base_distributor.rb, line 53 def default_node_tests raise NotImplementedError end
post_assign_test_files_to_node()
click to toggle source
# File lib/knapsack/distributors/base_distributor.rb, line 49 def post_assign_test_files_to_node raise NotImplementedError end
post_tests_for_node(node_index)
click to toggle source
# File lib/knapsack/distributors/base_distributor.rb, line 45 def post_tests_for_node(node_index) raise NotImplementedError end