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

Add tests for pre-existing unix paths

1. test_binder.rb - test_pre_existing_unix

2. test_integration_cluster.rb - test_pre_existing_unix
This commit is contained in:
MSP-Greg 2019-10-01 09:01:45 -05:00
parent 1a484d8d1c
commit 9ce8d4fc4e
2 changed files with 36 additions and 1 deletions

View file

@ -78,6 +78,23 @@ class TestBinder < TestBinderBase
assert_parsing_logs_uri [:tcp, :unix]
end
def test_pre_existing_unix
skip UNIX_SKT_MSG unless UNIX_SKT_EXIST
unix_path = "test/#{name}_server.sock"
File.open(unix_path, mode: 'wb') { |f| f.puts 'pre eixisting' }
@binder.parse ["unix://#{unix_path}"], @events
assert_match %r!unix://#{unix_path}!, @events.stdout.string
refute_includes @binder.instance_variable_get(:@unix_paths), unix_path
ensure
if UNIX_SKT_EXIST
File.unlink unix_path if File.exist? unix_path
end
end
private
def assert_parsing_logs_uri(order = [:unix, :tcp])

View file

@ -12,7 +12,25 @@ class TestIntegrationCluster < TestIntegration
end
def teardown
super if HAS_FORK
return if skipped?
super
end
def test_pre_existing_unix
skip UNIX_SKT_MSG unless UNIX_SKT_EXIST
File.open(@bind_path, mode: 'wb') { |f| f.puts 'pre eixisting' }
cli_server "-w #{WORKERS} -t 0:6 -q test/rackup/sleep_step.ru", unix: :unix
stop_server
assert File.exist?(@bind_path)
ensure
if UNIX_SKT_EXIST
File.unlink @bind_path if File.exist? @bind_path
end
end
def test_siginfo_thread_print