Commit 2fa30478 authored by Ash McKenzie's avatar Ash McKenzie

Use higher level status to determine readiness

parent 730ace4f
...@@ -138,12 +138,10 @@ module QA ...@@ -138,12 +138,10 @@ module QA
Time.new.tap do |start| Time.new.tap do |start|
while Time.new - start < 120 while Time.new - start < 120
begin begin
Net::HTTP.get(URI.join(@address, '/-/readiness')).tap do |body| if host_ready?
if JSON.parse(body).all? { |_, service| service['status'] == 'ok' } return puts "\nSecondary ready after #{Time.now - start} seconds." # rubocop:disable Cop/AvoidReturnFromBlocks
return puts "\nSecondary ready after #{Time.now - start} seconds." # rubocop:disable Cop/AvoidReturnFromBlocks else
else print '.'
print '.'
end
end end
rescue StandardError rescue StandardError
print 'e' print 'e'
...@@ -168,6 +166,13 @@ module QA ...@@ -168,6 +166,13 @@ module QA
QA::Page::Main::Menu.perform(&:sign_out) QA::Page::Main::Menu.perform(&:sign_out)
end end
end end
private
def host_ready?
body = Net::HTTP.get(URI.join(@address, '/-/readiness'))
JSON.parse(body)['status'] == 'ok'
end
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment