From 393a48ccca9fb2d17f5225fdf06d038bfd25c55d Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Mon, 31 Oct 2011 14:50:40 -0700 Subject: [PATCH] retry integration test if server is not yet up and running --- test/integration_test.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/integration_test.rb b/test/integration_test.rb index c91f097c..83c9821b 100644 --- a/test/integration_test.rb +++ b/test/integration_test.rb @@ -1,6 +1,7 @@ require File.expand_path('../helper', __FILE__) require 'rbconfig' require 'open-uri' +require 'timeout' class IntegrationTest < Test::Unit::TestCase it 'starts a top level application' do @@ -16,7 +17,14 @@ class IntegrationTest < Test::Unit::TestCase cmd << app_file.inspect cmd << "2>&1" pipe = IO.popen(cmd.join(" ")) - assert_equal open('http://localhost:4567/app_file').read, app_file + Timeout.timeout(10) do + begin + assert_equal open('http://localhost:4567/app_file').read, app_file + rescue Errno::ECONNREFUSED + sleep 0.1 + retry + end + end Process.kill("TERM", pipe.pid) end end