refactor(dialer): it should close idle connections (#457)
Like we did before for the resolver, a dialer should propagate the request to close idle connections to underlying types. See https://github.com/ooni/probe/issues/1591
This commit is contained in:
parent
a3a27b1ebf
commit
7a9499fee3
17 changed files with 207 additions and 36 deletions
|
|
@ -82,3 +82,21 @@ func TestResolverLegacyAdapterDefaults(t *testing.T) {
|
|||
}
|
||||
r.CloseIdleConnections() // does not crash
|
||||
}
|
||||
|
||||
func TestDialerLegacyAdapterWithCompatibleType(t *testing.T) {
|
||||
var called bool
|
||||
r := NewDialerLegacyAdapter(&mocks.Dialer{
|
||||
MockCloseIdleConnections: func() {
|
||||
called = true
|
||||
},
|
||||
})
|
||||
r.CloseIdleConnections()
|
||||
if !called {
|
||||
t.Fatal("not called")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDialerLegacyAdapterDefaults(t *testing.T) {
|
||||
r := NewDialerLegacyAdapter(&net.Dialer{})
|
||||
r.CloseIdleConnections() // does not crash
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue