diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-01 12:19:15 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-01 12:19:15 +0000 |
commit | 28130c1c63a4b1cbcc05f11ef84cd414685c3b6c (patch) | |
tree | f7c4ae3b1b32d48f2f8d62f9cdd71f0484da4b9e /test | |
parent | ed5de3814a1cd8e778c70d89d6c442ed17504385 (diff) | |
download | ruby-28130c1c63a4b1cbcc05f11ef84cd414685c3b6c.tar.gz |
* test/net/http/test_http.rb (test_bind_to_local_port): Choose an open
port more reliably.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/net/http/test_http.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb index 709a2e2370..b07e2a48d6 100644 --- a/test/net/http/test_http.rb +++ b/test/net/http/test_http.rb @@ -910,7 +910,9 @@ class TestNetHTTPLocalBind < Test::Unit::TestCase http = Net::HTTP.new(config('host'), config('port')) http.local_host = Addrinfo.tcp(config('host'), config('port')).ip_address - http.local_port = [*10000..20000].shuffle.first.to_s + http.local_port = Addrinfo.tcp(config('host'), 0).bind {|s| + s.local_address.ip_port.to_s + } assert_not_nil(http.local_host) assert_not_nil(http.local_port) |