1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

test_binder.rb - split out test causing issues when run parallel (#2830)

This commit is contained in:
MSP-Greg 2022-02-17 17:51:34 -06:00 committed by GitHub
parent 2d5582a60b
commit bdbd46ebbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,7 +31,7 @@ class TestBinderBase < Minitest::Test
end
end
class TestBinder < TestBinderBase
class TestBinderParallel < TestBinderBase
parallelize_me!
def test_synthesize_binds_from_activated_fds_no_sockets
@ -275,24 +275,6 @@ class TestBinder < TestBinderBase
assert_equal @log_writer.stderr, env_hash["rack.errors"]
end
def test_ssl_binder_sets_backlog
skip_unless :ssl
host = '127.0.0.1'
port = UniquePort.call
tcp_server = TCPServer.new(host, port)
tcp_server.define_singleton_method(:listen) do |backlog|
Thread.current[:backlog] = backlog
super(backlog)
end
TCPServer.stub(:new, tcp_server) do
@binder.parse ["ssl://#{host}:#{port}?#{ssl_query}&backlog=2048"], @log_writer
end
assert_equal 2048, Thread.current[:backlog]
end
def test_close_calls_close_on_ios
@mocked_ios = [Minitest::Mock.new, Minitest::Mock.new]
@mocked_ios.each { |m| m.expect(:close, true) }
@ -472,6 +454,26 @@ class TestBinder < TestBinderBase
end
end
class TestBinderSinigle < TestBinderBase
def test_ssl_binder_sets_backlog
skip_unless :ssl
host = '127.0.0.1'
port = UniquePort.call
tcp_server = TCPServer.new(host, port)
tcp_server.define_singleton_method(:listen) do |backlog|
Thread.current[:backlog] = backlog
super(backlog)
end
TCPServer.stub(:new, tcp_server) do
@binder.parse ["ssl://#{host}:#{port}?#{ssl_query}&backlog=2048"], @log_writer
end
assert_equal 2048, Thread.current[:backlog]
end
end
class TestBinderJRuby < TestBinderBase
def test_binder_parses_jruby_ssl_options
skip_unless :ssl