Class: KnapsackPro::BuildDistributionFetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/knapsack_pro/build_distribution_fetcher.rb

Defined Under Namespace

Classes: BuildDistributionEntity

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.callObject



21
22
23
# File 'lib/knapsack_pro/build_distribution_fetcher.rb', line 21

def self.call
  new.call
end

Instance Method Details

#callObject

get test files and time execution for last build distribution matching: branch, node_total, node_index



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/knapsack_pro/build_distribution_fetcher.rb', line 27

def call
  connection = KnapsackPro::Client::Connection.new(build_action)
  response = connection.call
  if connection.success?
    raise ArgumentError.new(response) if connection.errors?
    BuildDistributionEntity.new(response)
  else
    KnapsackPro.logger.warn("Slow test files fallback behaviour started. We could not connect with Knapsack Pro API to fetch last CI build test files that are needed to determine slow test files. No test files will be split by test cases. It means all test files will be split by the whole test files as if split by test cases would be disabled https://github.com/KnapsackPro/knapsack_pro-ruby#split-test-files-by-test-cases")
    BuildDistributionEntity.new({
      'time_execution' => 0.0,
      'test_files' => [],
    })
  end
end