Right now Server doesn't really support port=0.
To WEBrick port=0 indicates that it should pick a port automatically. This still works with XMLRPC::Server as the argument is simply passed along. Currently there is no way to get the automatically determined port though. So, you can tell the server to pick a port but then you don't know which port it picked :roll_eyes:
It would be lovely if Server could get a simple forwarded attribute to either read webrick's config[:Port] or to config as a whole.
For unit testing purposes I do not care about the actual port used, I do however care that this port is dynamically picked so it doesn't conflict with concurrently running tests and/or other services.
s = XMLRPC::Server.new(0)
port = s.port # @server.config.fetch(:Port)
url = "http://localhost:#{port}"
test_handlers(url)
Right now
Server
doesn't really supportport=0
. To WEBrickport=0
indicates that it should pick a port automatically. This still works with XMLRPC::Server as the argument is simply passed along. Currently there is no way to get the automatically determined port though. So, you can tell the server to pick a port but then you don't know which port it picked :roll_eyes: It would be lovely if Server could get a simple forwarded attribute to either read webrick'sconfig[:Port]
or toconfig
as a whole.For unit testing purposes I do not care about the actual port used, I do however care that this port is dynamically picked so it doesn't conflict with concurrently running tests and/or other services.