Skip to content

Commit

Permalink
don't let integration tests block indefinitely
Browse files Browse the repository at this point in the history
  • Loading branch information
rkh committed Mar 18, 2012
1 parent df317cf commit fbdb25b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions test/integration_helper.rb
Expand Up @@ -2,6 +2,7 @@
require 'rbconfig'
require 'open-uri'
require 'net/http'
require 'timeout'

module IntegrationHelper
class BaseServer
Expand Down Expand Up @@ -65,7 +66,7 @@ def ping(timeout = 30)
def alive?
3.times { get('/ping') }
true
rescue Errno::ECONNREFUSED, Errno::ECONNRESET, EOFError, SystemCallError, OpenURI::HTTPError => error
rescue Errno::ECONNREFUSED, Errno::ECONNRESET, EOFError, SystemCallError, OpenURI::HTTPError, Timeout::Error => error
false
end

Expand All @@ -79,7 +80,7 @@ def get_stream(url = "/stream", &block)
end

def get(url)
open("http://127.0.0.1:#{port}#{url}").read
Timeout.timeout(1) { open("http://127.0.0.1:#{port}#{url}").read }
end

def log
Expand Down
1 change: 0 additions & 1 deletion test/integration_test.rb
@@ -1,6 +1,5 @@
require File.expand_path('../helper', __FILE__)
require File.expand_path('../integration_helper', __FILE__)
require 'timeout'

# These tests start a real server and talk to it over TCP.
# Every test runs with every detected server.
Expand Down

0 comments on commit fbdb25b

Please sign in to comment.