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

ruby-changes:31447

From: akr <ko1@a...>
Date: Mon, 4 Nov 2013 22:22:01 +0900 (JST)
Subject: [ruby-changes:31447] akr:r43526 (trunk): * test/xmlrpc: Don't use fixed ports: 8070 and 8071.

akr	2013-11-04 22:21:53 +0900 (Mon, 04 Nov 2013)

  New Revision: 43526

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

  Log:
    * test/xmlrpc: Don't use fixed ports: 8070 and 8071.

  Modified files:
    trunk/ChangeLog
    trunk/test/xmlrpc/test_cookie.rb
    trunk/test/xmlrpc/test_webrick_server.rb
    trunk/test/xmlrpc/webrick_testing.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43525)
+++ ChangeLog	(revision 43526)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Nov  4 22:20:16 2013  Tanaka Akira  <akr@f...>
+
+	* test/xmlrpc: Don't use fixed ports: 8070 and 8071.
+
 Mon Nov  4 15:25:52 2013  Tanaka Akira  <akr@f...>
 
 	* test/xmlrpc/webrick_testing.rb (start_server): Initialize the server
Index: test/xmlrpc/webrick_testing.rb
===================================================================
--- test/xmlrpc/webrick_testing.rb	(revision 43525)
+++ test/xmlrpc/webrick_testing.rb	(revision 43526)
@@ -20,6 +20,8 @@ module WEBrick_Testing https://github.com/ruby/ruby/blob/trunk/test/xmlrpc/webrick_testing.rb#L20
     yield @__server
     @__started = true
 
+    addr = @__server.listeners.first.connect_address
+
     @__server_thread = Thread.new {
       begin
         @__server.start
@@ -29,6 +31,8 @@ module WEBrick_Testing https://github.com/ruby/ruby/blob/trunk/test/xmlrpc/webrick_testing.rb#L31
         @__started = false
       end
     }
+
+    addr
   end
 
   def stop_server
Index: test/xmlrpc/test_cookie.rb
===================================================================
--- test/xmlrpc/test_cookie.rb	(revision 43525)
+++ test/xmlrpc/test_cookie.rb	(revision 43526)
@@ -66,18 +66,17 @@ class TestCookie < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/xmlrpc/test_cookie.rb#L66
     s
   end
 
-  def setup_http_server(port)
-    option = {:Port => port}
+  def setup_http_server
+    option = {:Port => 0}
 
-    start_server(option) {|w| w.mount('/RPC2', create_servlet) }
+    addr = start_server(option) {|w| w.mount('/RPC2', create_servlet) }
 
-    @s = XMLRPC::Client.new3(:port => port)
+    @s = XMLRPC::Client.new3(:host => addr.ip_address, :port => addr.ip_port)
   end
 
-  PORT = 8070
   def test_cookie
     begin
-      setup_http_server(PORT)
+      setup_http_server
       do_test
     ensure
       stop_server
Index: test/xmlrpc/test_webrick_server.rb
===================================================================
--- test/xmlrpc/test_webrick_server.rb	(revision 43525)
+++ test/xmlrpc/test_webrick_server.rb	(revision 43526)
@@ -47,10 +47,10 @@ class Test_Webrick < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/xmlrpc/test_webrick_server.rb#L47
     return s
   end
 
-  def setup_http_server(port, use_ssl)
+  def setup_http_server(use_ssl)
     option = {
       :BindAddress => "localhost",
-      :Port => port,
+      :Port => 0,
       :SSLEnable => use_ssl,
     }
     if use_ssl
@@ -64,19 +64,18 @@ class Test_Webrick < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/xmlrpc/test_webrick_server.rb#L64
     start_server(option) {|w| w.mount('/RPC2', create_servlet) }
   end
 
-  PORT = 8071
   def test_client_server
     # NOTE: I don't enable SSL testing as this hangs
     [false].each do |use_ssl|
       begin
-        setup_http_server(PORT, use_ssl)
-        @s = XMLRPC::Client.new3(:port => PORT, :use_ssl => use_ssl)
+        addr = setup_http_server(use_ssl)
+        @s = XMLRPC::Client.new3(:host => addr.ip_address, :port => addr.ip_port, :use_ssl => use_ssl)
         @s.user = 'admin'
         @s.password = 'admin'
         silent do
           do_test
         end
-        @s = XMLRPC::Client.new3(:port => PORT, :use_ssl => use_ssl)
+        @s = XMLRPC::Client.new3(:host => addr.ip_address, :port => addr.ip_port, :use_ssl => use_ssl)
         @s.user = '01234567890123456789012345678901234567890123456789012345678901234567890123456789'
         @s.password = 'guest'
         silent do

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

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