Sha256: 639bc5731a78d8eac67c224caa7ea088371857685cd9359f7e6fc1e5d6f5fa88

Contents?: true

Size: 851 Bytes

Versions: 139

Compression:

Stored size: 851 Bytes

Contents

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

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

def generate_hosts(total)
  FactoryBot.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 = FactoryBot.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 = FactoryBot.create(:targeting, :search_query => "comment = benchmark-#{Foreman.uuid}", :user => User.current)
      targeting.resolve_hosts!
    end
  end
end

Version data entries

139 entries across 139 versions & 1 rubygems

Version Path
foreman_remote_execution-14.1.1 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-14.0.2 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-14.0.1 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-13.2.6 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-14.0.0 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-13.2.5 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-13.2.4 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-13.2.3 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-13.2.2 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-12.0.7 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-13.2.1 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-13.2.0 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-10.1.3 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-13.0.0 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-12.0.5 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-12.0.4 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-12.0.1 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-12.0.2 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-11.1.3 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-10.1.2 test/benchmark/targeting_benchmark.rb