mirror of
https://github.com/discourse/discourse.git
synced 2025-02-07 00:15:15 +08:00
fix bench script silent minor bugs
This commit is contained in:
parent
8370b4b1b7
commit
a940f727cb
|
@ -49,13 +49,15 @@ def run(command, opt = nil)
|
||||||
system(command, out: $stdout, err: :out)
|
system(command, out: $stdout, err: :out)
|
||||||
end
|
end
|
||||||
|
|
||||||
exit unless exit_status
|
abort("Command '#{command}' failed with exit status #{$?}") unless exit_status
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
require 'facter'
|
require 'facter'
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
run "gem install facter"
|
run "gem install facter"
|
||||||
|
# Facter requires CFPropertyList, but doesn't install it.
|
||||||
|
run "gem install CFPropertyList"
|
||||||
puts "please rerun script"
|
puts "please rerun script"
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
@ -151,12 +153,12 @@ run("bundle exec ruby script/profile_db_generator.rb")
|
||||||
puts "Getting api key"
|
puts "Getting api key"
|
||||||
api_key = `bundle exec rake api_key:get`.split("\n")[-1]
|
api_key = `bundle exec rake api_key:get`.split("\n")[-1]
|
||||||
|
|
||||||
def bench(path)
|
def bench(path, name)
|
||||||
puts "Running apache bench warmup"
|
puts "Running apache bench warmup"
|
||||||
add = ""
|
add = ""
|
||||||
add = "-c 3 " if @unicorn
|
add = "-c 3 " if @unicorn
|
||||||
`ab #{add} -n 10 "http://127.0.0.1:#{@port}#{path}"`
|
`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}"`
|
`ab -n #{@iterations} -e tmp/ab.csv "http://127.0.0.1:#{@port}#{path}"`
|
||||||
|
|
||||||
percentiles = Hash[*[50, 75, 90, 99].zip([]).flatten]
|
percentiles = Hash[*[50, 75, 90, 99].zip([]).flatten]
|
||||||
|
@ -212,7 +214,7 @@ begin
|
||||||
results = {}
|
results = {}
|
||||||
@best_of.times do
|
@best_of.times do
|
||||||
tests.each do |name, url|
|
tests.each do |name, url|
|
||||||
results[name] = best_of(bench(url),results[name])
|
results[name] = best_of(bench(url, name),results[name])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ end
|
||||||
|
|
||||||
def create_admin(seq)
|
def create_admin(seq)
|
||||||
User.new.tap { |admin|
|
User.new.tap { |admin|
|
||||||
admin.email = "admin@localhost#{seq}"
|
admin.email = "admin@localhost#{seq}.fake"
|
||||||
admin.username = "admin#{seq}"
|
admin.username = "admin#{seq}"
|
||||||
admin.password = "password"
|
admin.password = "password"
|
||||||
admin.save
|
admin.save
|
||||||
|
|
Loading…
Reference in New Issue
Block a user