added test for connection coalescing (and removed the certificate verification disable flag)

This commit is contained in:
HoneyryderChuck 2019-12-15 17:12:15 +00:00
parent d0587563a6
commit 8ca59545a2
2 changed files with 16 additions and 4 deletions

View File

@ -23,6 +23,22 @@ class HTTPSTest < Minitest::Test
include Plugins::Retries
include Plugins::Multipart
def test_connection_coalescing
coalesced_origin = "https://#{ENV["HTTPBIN_COALESCING_HOST"]}"
HTTPX.wrap do |http|
response1 = http.get(origin)
verify_status(response1, 200)
response2 = http.get(coalesced_origin)
verify_status(response2, 200)
# introspection time
pool = http.__send__(:pool)
connections = pool.instance_variable_get(:@connections)
assert connections.any? { |conn|
conn.instance_variable_get(:@origins) == [origin, coalesced_origin]
}, "connections didn't coalesce (expected connection with both origins)"
end
end if ENV.key?("HTTPBIN_COALESCING_HOST")
private
def origin(orig = httpbin)

View File

@ -14,9 +14,5 @@ end
require "httpx"
# TODO: remove this once ruby 2.5 bug is fixed:
# https://github.com/ruby/openssl/issues/187
ENV["CI"] && OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:verify_mode] = 0
Dir[File.join(".", "test", "support", "*.rb")].each { |f| require f }
Dir[File.join(".", "test", "support", "**", "*.rb")].each { |f| require f }