Sha256: f289d2a0beafd987624e99a190129bd9e9c248247614b71120af2e5428289a29

Contents?: true

Size: 1.31 KB

Versions: 6

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

module KnapsackPro
  class SlowTestFileFinder
    # Get recorded test files from API.
    # Find slow tests among them that are still present on the disk.
    # Save slow test files in json file on the disk.
    # Returns slow test files.
    def self.call(adapter_class)
      if KnapsackPro::Config::Env.test_files_encrypted?
        raise "Split by test cases is not possible when you have enabled test file names encryption ( #{KnapsackPro::Urls::ENCRYPTION} ). You need to disable encryption with KNAPSACK_PRO_TEST_FILES_ENCRYPTED=false in order to use split by test cases #{KnapsackPro::Urls::SPLIT_BY_TEST_EXAMPLES}"
      end

      # get list of recorded test files for last CI Build
      build_distribution_entity = KnapsackPro::BuildDistributionFetcher.call
      test_files_from_api = build_distribution_entity.test_files

      merged_test_files_from_api = KnapsackPro::TestCaseMergers::BaseMerger.call(adapter_class, test_files_from_api)

      test_files_existing_on_disk = KnapsackPro::TestFileFinder.select_test_files_that_can_be_run(adapter_class, merged_test_files_from_api)

      slow_test_files = KnapsackPro::SlowTestFileDeterminer.call(test_files_existing_on_disk)

      KnapsackPro::SlowTestFileDeterminer.save_to_json_report(slow_test_files)

      slow_test_files
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
knapsack_pro-7.13.1 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-7.13.0 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-7.12.1 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-7.12.0 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-7.11.0 lib/knapsack_pro/slow_test_file_finder.rb
knapsack_pro-7.10.0 lib/knapsack_pro/slow_test_file_finder.rb