Smoke test should wait up to 5 minutes before it fails

This commit is contained in:
Gerhard Schlager 2018-05-15 14:40:33 +02:00
parent 93ed8d2522
commit 34d4712133
1 changed files with 14 additions and 5 deletions

View File

@ -26,12 +26,21 @@ task "smoke:test" do
request.basic_auth(ENV['AUTH_USER'], ENV['AUTH_PASSWORD']) request.basic_auth(ENV['AUTH_USER'], ENV['AUTH_PASSWORD'])
end end
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http| start = Time.now
http.request(request) while true
end response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
http.request(request)
end
if response.code != "200" break if response.code == "200"
raise "TRIVIAL GET FAILED WITH #{response.code}"
# retry for up to 5 minutes
if Time.now - start < 300
puts "Connection failed with #{response.code}. Retrying in 5 seconds..."
sleep(5)
else
raise "TRIVIAL GET FAILED WITH #{response.code}"
end
end end
results = "" results = ""