summaryrefslogtreecommitdiff
path: root/test/xmlrpc
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-04 13:21:53 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-04 13:21:53 +0000
commit7a3f2845df7fe3fd9a2b0649e555dba7301fa164 (patch)
tree6b193327bc561c4c8989c72bdb6d69b80d150981 /test/xmlrpc
parentc7ea716d27a7c55db2f0fc25466122ac094433b5 (diff)
* test/xmlrpc: Don't use fixed ports: 8070 and 8071.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/xmlrpc')
-rw-r--r--test/xmlrpc/test_cookie.rb11
-rw-r--r--test/xmlrpc/test_webrick_server.rb11
-rw-r--r--test/xmlrpc/webrick_testing.rb4
3 files changed, 14 insertions, 12 deletions
diff --git a/test/xmlrpc/test_cookie.rb b/test/xmlrpc/test_cookie.rb
index 51f0be0..11bf10e 100644
--- a/test/xmlrpc/test_cookie.rb
+++ b/test/xmlrpc/test_cookie.rb
@@ -66,18 +66,17 @@ class TestCookie < Test::Unit::TestCase
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
diff --git a/test/xmlrpc/test_webrick_server.rb b/test/xmlrpc/test_webrick_server.rb
index 2c91727..657830e 100644
--- a/test/xmlrpc/test_webrick_server.rb
+++ b/test/xmlrpc/test_webrick_server.rb
@@ -47,10 +47,10 @@ class Test_Webrick < Test::Unit::TestCase
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::TestCase
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
diff --git a/test/xmlrpc/webrick_testing.rb b/test/xmlrpc/webrick_testing.rb
index c72895a..464d61d 100644
--- a/test/xmlrpc/webrick_testing.rb
+++ b/test/xmlrpc/webrick_testing.rb
@@ -20,6 +20,8 @@ module WEBrick_Testing
yield @__server
@__started = true
+ addr = @__server.listeners.first.connect_address
+
@__server_thread = Thread.new {
begin
@__server.start
@@ -29,6 +31,8 @@ module WEBrick_Testing
@__started = false
end
}
+
+ addr
end
def stop_server