mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 02:49:29 +08:00
warmup prior to running tests
This commit is contained in:
parent
bf0d70e820
commit
6e3b2cc860
|
@ -51,6 +51,25 @@ task "qunit:test", [:timeout] => :environment do |_, args|
|
||||||
cmd += " #{args[:timeout]}"
|
cmd += " #{args[:timeout]}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@now = Time.now
|
||||||
|
def elapsed
|
||||||
|
Time.now - @now
|
||||||
|
end
|
||||||
|
|
||||||
|
# wait for server to accept connections
|
||||||
|
require 'net/http'
|
||||||
|
uri = URI("http://localhost:#{port}/assets/test_helper.js")
|
||||||
|
puts "Warming up Rails server"
|
||||||
|
begin
|
||||||
|
Net::HTTP.get(uri)
|
||||||
|
rescue Errno::ECONNREFUSED
|
||||||
|
sleep 1
|
||||||
|
retry unless elapsed() > 60
|
||||||
|
puts "Timed out. Can no connect to forked server!"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
puts "Rails server is warmed up"
|
||||||
|
|
||||||
# wait for server to respond, will exception out on failure
|
# wait for server to respond, will exception out on failure
|
||||||
tries = 0
|
tries = 0
|
||||||
begin
|
begin
|
||||||
|
|
Loading…
Reference in New Issue
Block a user