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

Add some tests to envs in binder

This commit is contained in:
Nate Berkopec 2020-03-07 07:34:35 -06:00
parent 2cef8ddae1
commit 800179242d
No known key found for this signature in database
GPG key ID: BDD7A4B8E43906A6
2 changed files with 19 additions and 1 deletions

View file

@ -43,7 +43,7 @@ module Puma
@ios = []
end
attr_reader :ios, :listeners, :unix_paths
attr_reader :ios, :listeners, :unix_paths, :proto_env, :envs
def env(sock)
@envs.fetch(sock, @proto_env)

View file

@ -138,6 +138,24 @@ class TestBinder < TestBinderBase
refute ssl_context_for_binder.no_tlsv1_1
end
def test_env_contains_protoenv
@binder.parse ["ssl://localhost:0?#{ssl_query}"], @events
env_hash = @binder.envs[@binder.ios.first]
@binder.proto_env.each do |k,v|
assert_equal env_hash[k], v
end
end
def test_env_contains_stderr
@binder.parse ["ssl://localhost:0?#{ssl_query}"], @events
env_hash = @binder.envs[@binder.ios.first]
assert_equal @events.stderr, env_hash["rack.errors"]
end
private
def assert_parsing_logs_uri(order = [:unix, :tcp])