fix(netxlite): http3 propagates CloseIdleConnections to its dialer (#471)
With this change, we are now able to change more dependent code to simplify the way in which we create and manage resolvers. See https://github.com/ooni/probe/issues/1591
This commit is contained in:
parent
bdad392b61
commit
b9c4ad0b2b
4 changed files with 27 additions and 5 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/ooni/probe-cli/v3/internal/netxlite/mocks"
|
||||
)
|
||||
|
||||
func TestHTTP3TransportWorks(t *testing.T) {
|
||||
|
|
@ -24,3 +25,18 @@ func TestHTTP3TransportWorks(t *testing.T) {
|
|||
resp.Body.Close()
|
||||
txp.CloseIdleConnections()
|
||||
}
|
||||
|
||||
func TestHTTP3TransportClosesIdleConnections(t *testing.T) {
|
||||
var called bool
|
||||
d := &mocks.QUICDialer{
|
||||
MockCloseIdleConnections: func() {
|
||||
called = true
|
||||
},
|
||||
}
|
||||
txp := NewHTTP3Transport(d, &tls.Config{})
|
||||
client := &http.Client{Transport: txp}
|
||||
client.CloseIdleConnections()
|
||||
if !called {
|
||||
t.Fatal("not called")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue