mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
c7ea716d27
commit
7a3f2845df
4 changed files with 18 additions and 12 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Mon Nov 4 22:20:16 2013 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* test/xmlrpc: Don't use fixed ports: 8070 and 8071.
|
||||||
|
|
||||||
Mon Nov 4 15:25:52 2013 Tanaka Akira <akr@fsij.org>
|
Mon Nov 4 15:25:52 2013 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* test/xmlrpc/webrick_testing.rb (start_server): Initialize the server
|
* test/xmlrpc/webrick_testing.rb (start_server): Initialize the server
|
||||||
|
|
|
@ -66,18 +66,17 @@ class TestCookie < Test::Unit::TestCase
|
||||||
s
|
s
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_http_server(port)
|
def setup_http_server
|
||||||
option = {:Port => port}
|
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
|
end
|
||||||
|
|
||||||
PORT = 8070
|
|
||||||
def test_cookie
|
def test_cookie
|
||||||
begin
|
begin
|
||||||
setup_http_server(PORT)
|
setup_http_server
|
||||||
do_test
|
do_test
|
||||||
ensure
|
ensure
|
||||||
stop_server
|
stop_server
|
||||||
|
|
|
@ -47,10 +47,10 @@ class Test_Webrick < Test::Unit::TestCase
|
||||||
return s
|
return s
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_http_server(port, use_ssl)
|
def setup_http_server(use_ssl)
|
||||||
option = {
|
option = {
|
||||||
:BindAddress => "localhost",
|
:BindAddress => "localhost",
|
||||||
:Port => port,
|
:Port => 0,
|
||||||
:SSLEnable => use_ssl,
|
:SSLEnable => use_ssl,
|
||||||
}
|
}
|
||||||
if use_ssl
|
if use_ssl
|
||||||
|
@ -64,19 +64,18 @@ class Test_Webrick < Test::Unit::TestCase
|
||||||
start_server(option) {|w| w.mount('/RPC2', create_servlet) }
|
start_server(option) {|w| w.mount('/RPC2', create_servlet) }
|
||||||
end
|
end
|
||||||
|
|
||||||
PORT = 8071
|
|
||||||
def test_client_server
|
def test_client_server
|
||||||
# NOTE: I don't enable SSL testing as this hangs
|
# NOTE: I don't enable SSL testing as this hangs
|
||||||
[false].each do |use_ssl|
|
[false].each do |use_ssl|
|
||||||
begin
|
begin
|
||||||
setup_http_server(PORT, use_ssl)
|
addr = setup_http_server(use_ssl)
|
||||||
@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 = 'admin'
|
@s.user = 'admin'
|
||||||
@s.password = 'admin'
|
@s.password = 'admin'
|
||||||
silent do
|
silent do
|
||||||
do_test
|
do_test
|
||||||
end
|
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.user = '01234567890123456789012345678901234567890123456789012345678901234567890123456789'
|
||||||
@s.password = 'guest'
|
@s.password = 'guest'
|
||||||
silent do
|
silent do
|
||||||
|
|
|
@ -20,6 +20,8 @@ module WEBrick_Testing
|
||||||
yield @__server
|
yield @__server
|
||||||
@__started = true
|
@__started = true
|
||||||
|
|
||||||
|
addr = @__server.listeners.first.connect_address
|
||||||
|
|
||||||
@__server_thread = Thread.new {
|
@__server_thread = Thread.new {
|
||||||
begin
|
begin
|
||||||
@__server.start
|
@__server.start
|
||||||
|
@ -29,6 +31,8 @@ module WEBrick_Testing
|
||||||
@__started = false
|
@__started = false
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addr
|
||||||
end
|
end
|
||||||
|
|
||||||
def stop_server
|
def stop_server
|
||||||
|
|
Loading…
Add table
Reference in a new issue