Sha256: 8f8979ae52f16bc4f2e83375adc16bb7e82385196099ff5239ff8b1790b4599f

Contents?: true

Size: 857 Bytes

Versions: 1

Compression:

Stored size: 857 Bytes

Contents

require "benchmark/benchmark_helper"
require 'dynflow/testing'

# Add plugin to FactoryGirl's paths
FactoryGirl.definition_file_paths << File.expand_path('../../factories', __FILE__)
FactoryGirl.reload

def generate_hosts(total)
  FactoryGirl.create_list(:host, total, :comment => "benchmark-#{Foreman.uuid}")
end

Rails.logger.level = Logger::ERROR

puts 'generating hosts'
generate_hosts(1000)
puts 'generating admin user'
admin = FactoryGirl.build(:user, :admin)
admin.save(:validate => false)
User.current = admin

puts 'starting benchmarking'
foreman_benchmark do
  Benchmark.ips do |x|
    x.config(:time => 10, :warmup => 0)

    x.report("rex-targeting-resolve-hosts") do
      targeting = FactoryGirl.create(:targeting, :search_query => "comment = benchmark-#{Foreman.uuid}", :user => User.current)
      targeting.resolve_hosts!
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreman_remote_execution-1.3.0 test/benchmark/targeting_benchmark.rb