[前][次][番号順一覧][スレッド一覧]

ruby-changes:30681

From: akr <ko1@a...>
Date: Sun, 1 Sep 2013 21:19:22 +0900 (JST)
Subject: [ruby-changes:30681] akr:r42760 (trunk): * test/net/http/test_http.rb (test_bind_to_local_port): Choose an open

akr	2013-09-01 21:19:15 +0900 (Sun, 01 Sep 2013)

  New Revision: 42760

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42760

  Log:
    * test/net/http/test_http.rb (test_bind_to_local_port): Choose an open
      port more reliably.

  Modified files:
    trunk/ChangeLog
    trunk/test/net/http/test_http.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42759)
+++ ChangeLog	(revision 42760)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Sep  1 21:17:54 2013  Tanaka Akira  <akr@f...>
+
+	* test/net/http/test_http.rb (test_bind_to_local_port): Choose an open
+	  port more reliably.
+
 Sun Sep  1 20:32:40 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (big2str_base_poweroftwo): Renamed from
Index: test/net/http/test_http.rb
===================================================================
--- test/net/http/test_http.rb	(revision 42759)
+++ test/net/http/test_http.rb	(revision 42760)
@@ -910,7 +910,9 @@ class TestNetHTTPLocalBind < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http.rb#L910
 
     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)
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]