diff --git a/test/test_binder.rb b/test/test_binder.rb index b5ab9aa575..8fb8af9975 100644 --- a/test/test_binder.rb +++ b/test/test_binder.rb @@ -50,6 +50,46 @@ def test_logs_all_localhost_bindings assert_match %r!tcp://\[::1\]:(\d+)!, @events.stdout.string end end + + def test_allows_both_unix_and_tcp + skip UNIX_SKT_MSG unless UNIX_SKT_EXIST + + path_unix = "test/#{name}_server.sock" + uri_unix = "unix://#{path_unix}" + uri_tcp = "tcp://127.0.0.1:#{UniquePort.call}" + + @binder.parse([uri_unix, uri_tcp], @events) + + stdout = @events.stdout.string + + assert stdout.include?(uri_unix), "\n#{stdout}\n" + assert stdout.include?(uri_tcp) , "\n#{stdout}\n" + + ensure + return if skipped? + @binder.close + File.unlink(path_unix) if File.exist? path_unix + end + + def test_allows_both_tcp_and_unix + skip UNIX_SKT_MSG unless UNIX_SKT_EXIST + + path_unix = "test/#{name}_server.sock" + uri_unix = "unix://#{path_unix}" + uri_tcp = "tcp://127.0.0.1:#{UniquePort.call}" + + @binder.parse([uri_tcp, uri_unix], @events) + + stdout = @events.stdout.string + + assert stdout.include?(uri_unix), "\n#{stdout}\n" + assert stdout.include?(uri_tcp) , "\n#{stdout}\n" + + ensure + return if skipped? + @binder.close + File.unlink(path_unix) if File.exist? path_unix + end end class TestBinderJRuby < TestBinderBase