Class: Knapsack::Distributors::ReportDistributor

Inherits:
BaseDistributor show all
Defined in:
lib/knapsack/distributors/report_distributor.rb

Instance Attribute Summary

Attributes inherited from BaseDistributor

#node_tests, #report, #test_file_pattern

Instance Method Summary collapse

Methods inherited from BaseDistributor

#all_tests, #assign_test_files_to_node, #ci_node_index, #ci_node_total, #initialize, #tests_for_current_node, #tests_for_node

Constructor Details

This class inherits a constructor from Knapsack::Distributors::BaseDistributor

Instance Method Details

#node_time_executionObject



16
17
18
# File 'lib/knapsack/distributors/report_distributor.rb', line 16

def node_time_execution
  @node_time_execution ||= total_time_execution / ci_node_total
end

#sorted_reportObject



4
5
6
# File 'lib/knapsack/distributors/report_distributor.rb', line 4

def sorted_report
  @sorted_report ||= report.sort_by { |test_path, time| time }.reverse
end

#sorted_report_with_existing_testsObject



8
9
10
# File 'lib/knapsack/distributors/report_distributor.rb', line 8

def sorted_report_with_existing_tests
  @sorted_report_with_existing_tests ||= sorted_report.select { |test_path, time| all_tests.include?(test_path) }
end

#total_time_executionObject



12
13
14
# File 'lib/knapsack/distributors/report_distributor.rb', line 12

def total_time_execution
  @total_time_execution ||= sorted_report_with_existing_tests.map(&:last).reduce(0, :+).to_f
end