Sha256: dda2e38e57d64f204dd3aba808c6ad17d06bb4f61ecf73c847cdf37d85954d58

Contents?: true

Size: 1.26 KB

Versions: 9

Compression:

Stored size: 1.26 KB

Contents

module KnapsackPro
  class Report
    def self.save
      test_files = KnapsackPro.tracker.to_a

      if test_files.empty?
        KnapsackPro.logger.info("Didn't save time execution report on API server because there are no test files matching criteria on this node. Probably reason might be very narrowed tests list - you run only tests with specified tag and there are fewer test files with the tag than node total number.")
        return
      end

      repository_adapter = KnapsackPro::RepositoryAdapterInitiator.call
      test_files = KnapsackPro::Utils.unsymbolize(test_files)
      encrypted_test_files = KnapsackPro::Crypto::Encryptor.call(test_files)
      action = KnapsackPro::Client::API::V1::BuildSubsets.create(
        commit_hash: repository_adapter.commit_hash,
        branch: repository_adapter.branch,
        node_total: KnapsackPro::Config::Env.ci_node_total,
        node_index: KnapsackPro::Config::Env.ci_node_index,
        test_files: encrypted_test_files,
      )
      connection = KnapsackPro::Client::Connection.new(action)
      response = connection.call
      if connection.success?
        raise ArgumentError.new(response) if connection.errors?
        KnapsackPro.logger.info('Saved time execution report on API server.')
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
knapsack_pro-0.17.0 lib/knapsack_pro/report.rb
knapsack_pro-0.16.0 lib/knapsack_pro/report.rb
knapsack_pro-0.15.2 lib/knapsack_pro/report.rb
knapsack_pro-0.15.1 lib/knapsack_pro/report.rb
knapsack_pro-0.15.0 lib/knapsack_pro/report.rb
knapsack_pro-0.14.0 lib/knapsack_pro/report.rb
knapsack_pro-0.13.0 lib/knapsack_pro/report.rb
knapsack_pro-0.12.0 lib/knapsack_pro/report.rb
knapsack_pro-0.11.0 lib/knapsack_pro/report.rb