Fix bugs in profiling scripts leading to incorrect results.
This commit is contained in:
parent
e70428ac8c
commit
26c6447161
|
@ -693,14 +693,12 @@ class User < ActiveRecord::Base
|
|||
if email_token = self.email_tokens.active.where(email: self.email).first
|
||||
EmailToken.confirm(email_token.token)
|
||||
else
|
||||
self.active = true
|
||||
save
|
||||
self.update!(active: true)
|
||||
end
|
||||
end
|
||||
|
||||
def deactivate
|
||||
self.active = false
|
||||
save
|
||||
self.update!(active: false)
|
||||
end
|
||||
|
||||
def change_trust_level!(level, opts = nil)
|
||||
|
|
|
@ -188,7 +188,7 @@ begin
|
|||
append = "?api_key=#{api_key}&api_username=admin1"
|
||||
|
||||
# asset precompilation is a dog, wget to force it
|
||||
run "wget http://127.0.0.1:#{@port}/ -O /dev/null"
|
||||
run "wget http://127.0.0.1:#{@port}/ -o /dev/null -O /dev/null"
|
||||
|
||||
tests = [
|
||||
["categories", "/categories"],
|
||||
|
@ -197,7 +197,13 @@ begin
|
|||
# ["user", "/u/admin1/activity"],
|
||||
]
|
||||
|
||||
tests = tests.map { |k, url| ["#{k}_admin", "#{url}#{append}"] } + tests
|
||||
tests.concat(tests.map { |k, url| ["#{k}_admin", "#{url}#{append}"] })
|
||||
|
||||
tests.each do |_, path|
|
||||
if `curl -s -I "http://127.0.0.1:#{@port}#{path}"` !~ /200 OK/
|
||||
raise "#{path} returned non 200 response code"
|
||||
end
|
||||
end
|
||||
|
||||
# NOTE: we run the most expensive page first in the bench
|
||||
|
||||
|
|
|
@ -46,10 +46,10 @@ def create_admin(seq)
|
|||
admin.email = "admin@localhost#{seq}.fake"
|
||||
admin.username = "admin#{seq}"
|
||||
admin.password = "password"
|
||||
admin.save
|
||||
admin.save!
|
||||
admin.grant_admin!
|
||||
admin.change_trust_level!(TrustLevel[4])
|
||||
admin.email_tokens.update_all(confirmed: true)
|
||||
admin.activate
|
||||
}
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue