diff --git a/test/helper.rb b/test/helper.rb index 887964a6..d230c60b 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -43,6 +43,15 @@ def hit(uris) end end +module UniquePort + @port = 3211 + + def self.call + @port += 1 + @port + end +end + module TimeoutEveryTestCase # our own subclass so we never confused different timeouts class TestTookTooLong < Timeout::Error diff --git a/test/test_persistent.rb b/test/test_persistent.rb index 94d7cc19..06ec90aa 100644 --- a/test/test_persistent.rb +++ b/test/test_persistent.rb @@ -21,14 +21,14 @@ class TestPersistent < Minitest::Test end @host = "127.0.0.1" - @port = 9988 + @port = UniquePort.call @server = Puma::Server.new @simple - @server.add_tcp_listener "127.0.0.1", 9988 + @server.add_tcp_listener "127.0.0.1", @port @server.max_threads = 1 @server.run - @client = TCPSocket.new "127.0.0.1", 9988 + @client = TCPSocket.new "127.0.0.1", @port end def teardown diff --git a/test/test_puma_server_ssl.rb b/test/test_puma_server_ssl.rb index 33afc080..89040353 100644 --- a/test/test_puma_server_ssl.rb +++ b/test/test_puma_server_ssl.rb @@ -22,7 +22,7 @@ class TestPumaServerSSL < Minitest::Test def setup return if DISABLE_SSL - port = 3212 + port = UniquePort.call host = "127.0.0.1" app = lambda { |env| [200, {}, [env['rack.url_scheme']]] } diff --git a/test/test_tcp_rack.rb b/test/test_tcp_rack.rb index f746c406..10ab7fe4 100644 --- a/test/test_tcp_rack.rb +++ b/test/test_tcp_rack.rb @@ -3,7 +3,7 @@ require_relative "helper" class TestTCPRack < Minitest::Test def setup - @port = 3212 + @port = UniquePort.call @host = "127.0.0.1" @events = Puma::Events.new STDOUT, STDERR