<commit_before>require 'rspec'
require 'bosh/dev/ruby_version'

namespace :fly do
  # bundle exec rake fly:unit
  desc 'Fly unit specs'
  task :unit do
    execute('test-unit', '-p', {
        DB: (ENV['DB'] || 'postgresql'),
        DB_VERSION: (ENV['DB_VERSION'] || '9.4')
    })
  end

  # bundle exec rake fly:integration
  desc 'Fly integration specs'
  task :integration do
    execute('test-integration', '-p', {
        DB: (ENV['DB'] || 'postgresql'), SPEC_PATH: (ENV['SPEC_PATH'] || nil)
    })
  end

  # bundle exec rake fly:integration_gocli
  desc 'Fly integration gocli specs'
  task :integration_gocli do
    execute('test-integration-gocli', '-p --inputs-from bosh/integration-postgres-gocli-sha2', {
        DB: (ENV['DB'] || 'postgresql'), SPEC_PATH: (ENV['SPEC_PATH'] || nil)
    })
  end

  # bundle exec rake fly:run["pwd ; ls -al"]
  task :run, [:command] do |_, args|
    execute('run', '-p', {
        COMMAND: %Q|\"#{args[:command]}\"|
    })
  end

  desc 'Fly integration parallel specs'
  task :integration_parallel do

    num_workers = 3
    num_groups = 24

    groups = (1..num_groups).group_by { |i| i%num_workers }.values
        .map { |group_values| group_values.join(',') }

    task_names = groups.each_with_index.map do |group, index|
      name = "integration_#{index + 1}"
      task name do
        execute('test-integration', '-p', {
            DB: (ENV['DB'] || 'postgresql'),
            SPEC_PATH: (ENV['SPEC_PATH'] || nil),
            GROUP: group,
            NUM_GROUPS: num_groups
        })
      end
      name
    end

    multitask _parallel_integration: task_names
    Rake::MultiTask[:_parallel_integration].invoke
  end

  desc 'Fly integration gocli parallel specs'
  task :integration_gocli_parallel do<commit_msg>Fix non-gocli for fly:integration rake<commit_after>require 'rspec'
require 'bosh/dev/ruby_version'

namespace :fly do
  # bundle exec rake fly:unit
  desc 'Fly unit specs'
  task :unit do
    execute('test-unit', '-p', {
        DB: (ENV['DB'] || 'postgresql'),
        DB_VERSION: (ENV['DB_VERSION'] || '9.4')
    })
  end

  # bundle exec rake fly:integration
  desc 'Fly integration specs'
  task :integration do
    execute('test-integration', '-p --inputs-from bosh/integration-2.3-postgres', {
        DB: (ENV['DB'] || 'postgresql'), SPEC_PATH: (ENV['SPEC_PATH'] || nil)
    })
  end

  # bundle exec rake fly:integration_gocli
  desc 'Fly integration gocli specs'
  task :integration_gocli do
    execute('test-integration-gocli', '-p --inputs-from bosh/integration-postgres-gocli-sha2', {
        DB: (ENV['DB'] || 'postgresql'), SPEC_PATH: (ENV['SPEC_PATH'] || nil)
    })
  end

  # bundle exec rake fly:run["pwd ; ls -al"]
  task :run, [:command] do |_, args|
    execute('run', '-p', {
        COMMAND: %Q|\"#{args[:command]}\"|
    })
  end

  desc 'Fly integration parallel specs'
  task :integration_parallel do

    num_workers = 3
    num_groups = 24

    groups = (1..num_groups).group_by { |i| i%num_workers }.values
        .map { |group_values| group_values.join(',') }

    task_names = groups.each_with_index.map do |group, index|
      name = "integration_#{index + 1}"
      task name do
        execute('test-integration', '-p --inputs-from bosh/integration-2.3-postgres', {
            DB: (ENV['DB'] || 'postgresql'),
            SPEC_PATH: (ENV['SPEC_PATH'] || nil),
            GROUP: group,
            NUM_GROUPS: num_groups
        })
      end
      name
    end

    multitask _parallel_integration: task_names
    Rake::MultiTask[:_parallel_integration].invoke
  end

  desc 'Fly integration gocli parallel specs'
  task :integration_gocli_parallel do
{'fraction_non_alphanumeric': 0.14843110504774898, 'fraction_numerical': 0.005457025920873124, 'mean_word_length': 2.9166666666666665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '119009', 'n_tokens_mistral': 1315, 'n_tokens_neox': 1221, 'n_words': 299}