diff --git a/script/bench.rb b/script/bench.rb index 27100005e64..9de35492a8c 100644 --- a/script/bench.rb +++ b/script/bench.rb @@ -49,13 +49,15 @@ def run(command, opt = nil) system(command, out: $stdout, err: :out) end - exit unless exit_status + abort("Command '#{command}' failed with exit status #{$?}") unless exit_status end begin require 'facter' rescue LoadError run "gem install facter" + # Facter requires CFPropertyList, but doesn't install it. + run "gem install CFPropertyList" puts "please rerun script" exit end @@ -151,12 +153,12 @@ run("bundle exec ruby script/profile_db_generator.rb") puts "Getting api key" api_key = `bundle exec rake api_key:get`.split("\n")[-1] -def bench(path) +def bench(path, name) puts "Running apache bench warmup" add = "" add = "-c 3 " if @unicorn `ab #{add} -n 10 "http://127.0.0.1:#{@port}#{path}"` - puts "Benchmarking #{path}" + puts "Benchmarking #{name} @ #{path}" `ab -n #{@iterations} -e tmp/ab.csv "http://127.0.0.1:#{@port}#{path}"` percentiles = Hash[*[50, 75, 90, 99].zip([]).flatten] @@ -212,7 +214,7 @@ begin results = {} @best_of.times do tests.each do |name, url| - results[name] = best_of(bench(url),results[name]) + results[name] = best_of(bench(url, name),results[name]) end end diff --git a/script/profile_db_generator.rb b/script/profile_db_generator.rb index b9de3618ff2..79b62064a72 100644 --- a/script/profile_db_generator.rb +++ b/script/profile_db_generator.rb @@ -44,7 +44,7 @@ end def create_admin(seq) User.new.tap { |admin| - admin.email = "admin@localhost#{seq}" + admin.email = "admin@localhost#{seq}.fake" admin.username = "admin#{seq}" admin.password = "password" admin.save