class KnapsackPro::BaseAllocatorBuilder
Constants
- TEST_RUNNER_MAP
Attributes
adapter_class[R]
Public Class Methods
new(adapter_class)
click to toggle source
# File lib/knapsack_pro/base_allocator_builder.rb, line 13 def initialize(adapter_class) @adapter_class = adapter_class ENV['KNAPSACK_PRO_TEST_RUNNER'] = TEST_RUNNER_MAP[adapter_class] end
Public Instance Methods
allocator()
click to toggle source
# File lib/knapsack_pro/base_allocator_builder.rb, line 18 def allocator raise NotImplementedError end
fallback_mode_test_files()
click to toggle source
in fallback mode we always want to run the whole test files (not split by test cases) to guarantee that each test will be executed at least once across parallel CI nodes
# File lib/knapsack_pro/base_allocator_builder.rb, line 29 def fallback_mode_test_files all_test_files_to_run end
fast_and_slow_test_files_to_run()
click to toggle source
detect test files present on the disk that should be run this may include some fast test files + slow test files split by test cases
# File lib/knapsack_pro/base_allocator_builder.rb, line 35 def fast_and_slow_test_files_to_run test_files_to_run = all_test_files_to_run if adapter_class.split_by_test_cases_enabled? slow_test_files = get_slow_test_files return test_files_to_run if slow_test_files.empty? test_file_cases = adapter_class.test_file_cases_for(slow_test_files) return KnapsackPro::TestFilesWithTestCasesComposer.call(test_files_to_run, slow_test_files, test_file_cases) end test_files_to_run end
test_dir()
click to toggle source
# File lib/knapsack_pro/base_allocator_builder.rb, line 22 def test_dir KnapsackPro::Config::Env.test_dir || TestFilePattern.test_dir(adapter_class) end
Private Instance Methods
all_test_files_to_run()
click to toggle source
# File lib/knapsack_pro/base_allocator_builder.rb, line 66 def all_test_files_to_run KnapsackPro::TestFileFinder.call(test_file_pattern) end
env()
click to toggle source
# File lib/knapsack_pro/base_allocator_builder.rb, line 54 def env KnapsackPro::Config::Env end
get_slow_test_files()
click to toggle source
# File lib/knapsack_pro/base_allocator_builder.rb, line 74 def get_slow_test_files slow_test_files = if slow_test_file_pattern KnapsackPro::TestFileFinder.slow_test_files_by_pattern(adapter_class) else # get slow test files from API and ensure they exist on disk KnapsackPro::SlowTestFileFinder.call(adapter_class) end KnapsackPro.logger.debug("Detected #{slow_test_files.size} slow test files: #{slow_test_files.inspect}") slow_test_files end
repository_adapter()
click to toggle source
# File lib/knapsack_pro/base_allocator_builder.rb, line 58 def repository_adapter KnapsackPro::RepositoryAdapterInitiator.call end
slow_test_file_pattern()
click to toggle source
# File lib/knapsack_pro/base_allocator_builder.rb, line 70 def slow_test_file_pattern KnapsackPro::Config::Env.slow_test_file_pattern end
test_file_pattern()
click to toggle source
# File lib/knapsack_pro/base_allocator_builder.rb, line 62 def test_file_pattern TestFilePattern.call(adapter_class) end