Sha256: 20278a1db4c14709e95cfc06fa932b78f43d12753beb42173c7c273a02790618

Contents?: true

Size: 857 Bytes

Versions: 8

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

8 entries across 8 versions & 1 rubygems

Version Path
foreman_remote_execution-1.3.7 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-1.3.6 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-1.4.1 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-1.3.5 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-1.3.4 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-1.3.3 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-1.3.2 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-1.3.1 test/benchmark/targeting_benchmark.rb