Skip to content

Commit

Permalink
Ensure rackup starts server listening on all hosts for reusable port …
Browse files Browse the repository at this point in the history
…test
  • Loading branch information
mikehale committed Apr 17, 2015
1 parent 4430b1b commit e637ba2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tests/basic_tests.rb
Expand Up @@ -94,7 +94,7 @@ def timed_streaming_test(endpoint, timeout)
connection = Excon.new(uri, :user => user, :password => pass )
response = connection.request(:method => :get, :path => '/content-length/100')
response.status
end
end
end
end

Expand Down Expand Up @@ -285,7 +285,7 @@ def self.find_alternate_ip(ip)
end
end

with_rackup('basic.ru') do
with_rackup('basic.ru', '0.0.0.0') do
connection = Excon.new("http://127.0.0.1:9292/echo",
:reuseaddr => true, # enable address and port reuse
:persistent => true # keep the socket open
Expand Down
6 changes: 3 additions & 3 deletions tests/test_helper.rb
Expand Up @@ -231,12 +231,12 @@ def rackup_path(*parts)
File.expand_path(File.join(File.dirname(__FILE__), 'rackups', *parts))
end

def with_rackup(name)
def with_rackup(name, host="127.0.0.1")
unless RUBY_PLATFORM == 'java'
GC.disable if RUBY_VERSION < '1.9'
pid, w, r, e = Open4.popen4("rackup", rackup_path(name))
pid, w, r, e = Open4.popen4("rackup", "--host", host, rackup_path(name))
else
pid, w, r, e = IO.popen4("rackup", rackup_path(name))
pid, w, r, e = IO.popen4("rackup", "--host", host, rackup_path(name))
end
until e.gets =~ /HTTPServer#start:/; end
yield
Expand Down

0 comments on commit e637ba2

Please sign in to comment.