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

Add tests to ensure that nio4r is not loaded into the puma master

This commit is contained in:
Chris LaRose 2020-12-16 19:45:03 -08:00
parent 4caf07a25f
commit 94fbed6335
2 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1,4 @@
prune_bundler true
before_fork do
puts "defined?(::NIO): #{defined?(::NIO).inspect}"
end

View file

@ -283,6 +283,25 @@ RUBY
assert_match(/defined\?\(::JSON\): nil/, line)
end
def test_nio4r_gem_not_required_in_master_process
cli_server "-w #{workers} -C test/config/prune_bundler_print_nio_defined.rb test/rackup/hello.ru"
line = @server.gets
assert_match(/defined\?\(::NIO\): nil/, line)
end
def test_nio4r_gem_not_required_in_master_process_when_using_control_server
@control_tcp_port = UniquePort.call
control_opts = "--control-url tcp://#{HOST}:#{@control_tcp_port} --control-token #{TOKEN}"
cli_server "-w #{workers} #{control_opts} -C test/config/prune_bundler_print_nio_defined.rb test/rackup/hello.ru"
line = @server.gets
assert_match(/Starting control server/, line)
line = @server.gets
assert_match(/defined\?\(::NIO\): nil/, line)
end
def test_application_is_loaded_exactly_once_if_using_preload_app
cli_server "-w #{workers} --preload test/rackup/write_to_stdout_on_boot.ru"