mirror of
https://github.com/discourse/discourse.git
synced 2025-03-21 09:58:54 +08:00
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
|
if email_token = self.email_tokens.active.where(email: self.email).first
|
||||||
EmailToken.confirm(email_token.token)
|
EmailToken.confirm(email_token.token)
|
||||||
else
|
else
|
||||||
self.active = true
|
self.update!(active: true)
|
||||||
save
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def deactivate
|
def deactivate
|
||||||
self.active = false
|
self.update!(active: false)
|
||||||
save
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def change_trust_level!(level, opts = nil)
|
def change_trust_level!(level, opts = nil)
|
||||||
|
@ -188,7 +188,7 @@ begin
|
|||||||
append = "?api_key=#{api_key}&api_username=admin1"
|
append = "?api_key=#{api_key}&api_username=admin1"
|
||||||
|
|
||||||
# asset precompilation is a dog, wget to force it
|
# 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 = [
|
tests = [
|
||||||
["categories", "/categories"],
|
["categories", "/categories"],
|
||||||
@ -197,7 +197,13 @@ begin
|
|||||||
# ["user", "/u/admin1/activity"],
|
# ["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
|
# 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.email = "admin@localhost#{seq}.fake"
|
||||||
admin.username = "admin#{seq}"
|
admin.username = "admin#{seq}"
|
||||||
admin.password = "password"
|
admin.password = "password"
|
||||||
admin.save
|
admin.save!
|
||||||
admin.grant_admin!
|
admin.grant_admin!
|
||||||
admin.change_trust_level!(TrustLevel[4])
|
admin.change_trust_level!(TrustLevel[4])
|
||||||
admin.email_tokens.update_all(confirmed: true)
|
admin.activate
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user