refactor(netx/resolver): add CloseIdleConnections to RoundTripper (#501)

While there, also change to pointer receiver and use internal
testing for what are clearly unit tests.

Part of https://github.com/ooni/probe/issues/1591.
This commit is contained in:
Simone Basso
2021-09-09 20:49:12 +02:00
committed by GitHub
parent 5ab3c3b689
commit 1eb9e8c9b0
13 changed files with 203 additions and 115 deletions
@@ -124,7 +124,7 @@ func TestConfigurerNewConfigurationResolverDNSOverHTTPSPowerdns(t *testing.T) {
if !ok {
t.Fatal("not the DNS transport we expected")
}
dohtxp, ok := stxp.RoundTripper.(resolver.DNSOverHTTPS)
dohtxp, ok := stxp.RoundTripper.(*resolver.DNSOverHTTPS)
if !ok {
t.Fatal("not the DNS transport we expected")
}
@@ -200,7 +200,7 @@ func TestConfigurerNewConfigurationResolverDNSOverHTTPSGoogle(t *testing.T) {
if !ok {
t.Fatal("not the DNS transport we expected")
}
dohtxp, ok := stxp.RoundTripper.(resolver.DNSOverHTTPS)
dohtxp, ok := stxp.RoundTripper.(*resolver.DNSOverHTTPS)
if !ok {
t.Fatal("not the DNS transport we expected")
}
@@ -276,7 +276,7 @@ func TestConfigurerNewConfigurationResolverDNSOverHTTPSCloudflare(t *testing.T)
if !ok {
t.Fatal("not the DNS transport we expected")
}
dohtxp, ok := stxp.RoundTripper.(resolver.DNSOverHTTPS)
dohtxp, ok := stxp.RoundTripper.(*resolver.DNSOverHTTPS)
if !ok {
t.Fatal("not the DNS transport we expected")
}
@@ -352,7 +352,7 @@ func TestConfigurerNewConfigurationResolverUDP(t *testing.T) {
if !ok {
t.Fatal("not the DNS transport we expected")
}
udptxp, ok := stxp.RoundTripper.(resolver.DNSOverUDP)
udptxp, ok := stxp.RoundTripper.(*resolver.DNSOverUDP)
if !ok {
t.Fatal("not the DNS transport we expected")
}