Skip to content

Commit

Permalink
Merge pull request #504 from mikehale/fix-497
Browse files Browse the repository at this point in the history
Ensure rackup starts server listening on all hosts for reusable port test
  • Loading branch information
geemus committed Apr 17, 2015
2 parents 4430b1b + e637ba2 commit 501f8a9
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 501f8a9

Please sign in to comment.