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-8.2.0 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-9.0.1 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-9.0.0 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-8.1.2 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-8.1.1 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-8.1.0 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-7.2.2 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-7.2.1 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-7.2.0 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-5.0.8 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-8.0.0 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-7.1.1 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-7.1.0 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-7.0.0 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-5.0.7 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-5.0.6 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-6.2.0 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-5.0.5 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-6.1.0 test/benchmark/targeting_benchmark.rb
foreman_remote_execution-5.0.4 test/benchmark/targeting_benchmark.rb