mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-02 03:28:25 +08:00
close conns directly in tests
This commit is contained in:
@ -60,7 +60,9 @@ func TestCancel(t *testing.T) {
|
||||
default:
|
||||
}
|
||||
|
||||
cancel()
|
||||
c1.Close()
|
||||
c2.Close()
|
||||
cancel() // listener
|
||||
|
||||
// wait to ensure other goroutines run and close things.
|
||||
<-time.After(time.Microsecond * 10)
|
||||
@ -113,6 +115,8 @@ func TestCloseLeak(t *testing.T) {
|
||||
<-time.After(time.Microsecond * 5)
|
||||
}
|
||||
|
||||
c1.Close()
|
||||
c2.Close()
|
||||
cancel() // close the listener
|
||||
wg.Done()
|
||||
}
|
||||
|
@ -82,7 +82,9 @@ func TestSecureCancel(t *testing.T) {
|
||||
default:
|
||||
}
|
||||
|
||||
cancel()
|
||||
c1.Close()
|
||||
c2.Close()
|
||||
cancel() // listener
|
||||
|
||||
// wait to ensure other goroutines run and close things.
|
||||
<-time.After(time.Microsecond * 10)
|
||||
@ -137,6 +139,8 @@ func TestSecureCloseLeak(t *testing.T) {
|
||||
<-time.After(time.Microsecond * 5)
|
||||
}
|
||||
|
||||
c1.Close()
|
||||
c2.Close()
|
||||
cancel() // close the listener
|
||||
wg.Done()
|
||||
}
|
||||
|
Reference in New Issue
Block a user