chore: improve testing and increase coverage (#794)
This diff improves testing and increases coverage inside the ./internal/netxlite and ./internal/tracex packages. See https://github.com/ooni/probe/issues/2121
This commit is contained in:
parent
464d03184e
commit
d5249a6cf7
11 changed files with 621 additions and 348 deletions
|
|
@ -177,29 +177,29 @@ func NewOOHTTPBaseTransport(dialer model.Dialer, tlsDialer model.TLSDialer) mode
|
|||
|
||||
// Ensure we correctly forward CloseIdleConnections.
|
||||
return &httpTransportConnectionsCloser{
|
||||
HTTPTransport: &stdlibTransport{&oohttp.StdlibTransport{Transport: txp}},
|
||||
HTTPTransport: &httpTransportStdlib{&oohttp.StdlibTransport{Transport: txp}},
|
||||
Dialer: dialer,
|
||||
TLSDialer: tlsDialer,
|
||||
}
|
||||
}
|
||||
|
||||
// stdlibTransport wraps oohttp.StdlibTransport to add .Network()
|
||||
type stdlibTransport struct {
|
||||
type httpTransportStdlib struct {
|
||||
StdlibTransport *oohttp.StdlibTransport
|
||||
}
|
||||
|
||||
var _ model.HTTPTransport = &stdlibTransport{}
|
||||
var _ model.HTTPTransport = &httpTransportStdlib{}
|
||||
|
||||
func (txp *stdlibTransport) CloseIdleConnections() {
|
||||
func (txp *httpTransportStdlib) CloseIdleConnections() {
|
||||
txp.StdlibTransport.CloseIdleConnections()
|
||||
}
|
||||
|
||||
func (txp *stdlibTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
func (txp *httpTransportStdlib) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
return txp.StdlibTransport.RoundTrip(req)
|
||||
}
|
||||
|
||||
// Network implements HTTPTransport.Network.
|
||||
func (txp *stdlibTransport) Network() string {
|
||||
func (txp *httpTransportStdlib) Network() string {
|
||||
return "tcp"
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue