Issue #6766 has been reported by luislavena (Luis Lavena).

----------------------------------------
Bug #6766: Unable to run tests for different builds due fixed port for Net::HTTPS
https://bugs.ruby-lang.org/issues/6766

Author: luislavena (Luis Lavena)
Status: Assigned
Priority: Normal
Assignee: naruse (Yui NARUSE)
Category: test
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-07-21 trunk 36487) [x64-mingw32]


=begin
Hello,

I found that (({test_https.rb})) uses a fixed port number to run its tests, which results in failures due Errno::EADDRINUSE sometimes due clash with another build in my system:

  20) Error:
 test_verify_none(TestNetHTTPS):
 Errno::EADDRINUSE: Only one usage of each socket address (protocol/network address/port) is normally permitted. - bind(2)
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `new'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `block in create_listeners'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:82:in `each'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:82:in `create_listeners'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/ssl.rb:88:in `listen'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/server.rb:70:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/httpserver.rb:45:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:62:in `new'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:62:in `spawn_server'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:30:in `setup'
 
  21) Error:
 test_timeout_during_SSL_handshake(TestNetHTTPS):
 Errno::EADDRINUSE: Only one usage of each socket address (protocol/network address/port) is normally permitted. - bind(2)
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `new'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `block in create_listeners'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:82:in `each'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:82:in `create_listeners'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/ssl.rb:88:in `listen'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/server.rb:70:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/httpserver.rb:45:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:62:in `new'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:62:in `spawn_server'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:30:in `setup'
 
  22) Error:
 test_post(TestNetHTTPS):
 Errno::EADDRINUSE: Only one usage of each socket address (protocol/network address/port) is normally permitted. - bind(2)
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `new'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `block in create_listeners'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:82:in `each'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:82:in `create_listeners'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/ssl.rb:88:in `listen'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/server.rb:70:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/httpserver.rb:45:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:62:in `new'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:62:in `spawn_server'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:30:in `setup'
 
  23) Error:
 test_identity_verify_failure(TestNetHTTPS):
 Errno::EADDRINUSE: Only one usage of each socket address (protocol/network address/port) is normally permitted. - bind(2)
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `new'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `block in create_listeners'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:82:in `each'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:82:in `create_listeners'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/ssl.rb:88:in `listen'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/server.rb:70:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/httpserver.rb:45:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:62:in `new'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:62:in `spawn_server'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:30:in `setup'
 
  24) Error:
 test_get(TestNetHTTPS):
 Errno::EADDRINUSE: Only one usage of each socket address (protocol/network address/port) is normally permitted. - bind(2)
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `new'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `block in create_listeners'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:82:in `each'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:82:in `create_listeners'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/ssl.rb:88:in `listen'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/server.rb:70:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/httpserver.rb:45:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:62:in `new'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:62:in `spawn_server'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:30:in `setup'
 
  25) Error:
 test_certificate_verify_failure(TestNetHTTPS):
 Errno::EADDRINUSE: Only one usage of each socket address (protocol/network address/port) is normally permitted. - bind(2)
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `new'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:85:in `block in create_listeners'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:82:in `each'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/utils.rb:82:in `create_listeners'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/ssl.rb:88:in `listen'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/server.rb:70:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/lib/webrick/httpserver.rb:45:in `initialize'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:62:in `new'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:62:in `spawn_server'
     C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/net/http/utils.rb:30:in `setup'
 
You can see the full log here:

http://ci.rubyinstaller.org/job/test-ruby-trunk-x64/15/console

I would like to suggest port configuration can be randomized based on Process.pid, that way avoiding clashes between two builds being executed at the same time.

Thoughts?
=end


-- 
http://bugs.ruby-lang.org/