Skip to content

Commit

Permalink
Adds failing test for #1986. We now have failing tests for both that …
Browse files Browse the repository at this point in the history
…issue and #1994
  • Loading branch information
nateberkopec committed Oct 1, 2019
1 parent e0cf703 commit 69412b1
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion test/test_binder.rb
Expand Up @@ -71,7 +71,45 @@ def test_correct_doublebind

stdout = @events.stdout.string

# Unsure of what to actually assert on here yet
%w[tcp ssl].each do |prot|
assert_match %r!#{prot}://127.0.0.1:(\d+)!, stdout
if @binder.loopback_addresses.include?("::1")
assert_match %r!#{prot}://\[::1\]:(\d+)!, stdout
end
end
end

def test_allows_both_unix_and_tcp
assert_parsing_logs_uri [:unix, :tcp]
end

def test_allows_both_tcp_and_unix
assert_parsing_logs_uri [:tcp, :unix]
end

private

def assert_parsing_logs_uri(order = [:unix, :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}"

if order == [:unix, :tcp]
@binder.parse([uri_tcp, uri_unix], @events)
elsif order == [:tcp, :unix]
@binder.parse([uri_unix, uri_tcp], @events)
else
raise ArgumentError
end

stdout = @events.stdout.string

assert stdout.include?(uri_unix), "\n#{stdout}\n"
assert stdout.include?(uri_tcp) , "\n#{stdout}\n"
ensure
@binder.close_unix_paths if UNIX_SKT_EXIST
end
end

Expand Down

0 comments on commit 69412b1

Please sign in to comment.