httpx/regression_tests/bug_0_19_3_test.rb
HoneyryderChuck d2a7cf3236 bug 0.19.3 regression: remove the actual HTTP requests from the tests
only the DNS part is relevant for the test, and performing the actual
requests fail intermitently in CI, making the pipelines fail constantly.
2022-03-06 16:18:13 +00:00

34 lines
886 B
Ruby

# frozen_string_literal: true
require "test_helper"
require "support/http_helpers"
require "support/minitest_extensions"
class Bug_0_19_3_Test < Minitest::Test
include HTTPHelpers
module MockConnectionPlugin
module ConnectionMethods
def send_request_to_parser(request)
response = HTTPX::Response.new(request, 200, "2.0", {})
request.emit(:response, response)
end
end
end
def test_dns_lookup_cache_for_domains_with_same_cname
HTTPX.plugin(SessionWithPool).plugin(MockConnectionPlugin).wrap do |http|
_response1 = http.get("https://accounts.vivapayments.com")
_response2 = http.get("https://api.vivapayments.com")
assert http.pool.connection_count == 2
conn1, conn2 = http.pool.connections
assert conn1.origin != conn2.origin
assert conn1.addresses.sort == conn2.addresses.sort
end
end
end