1
0
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:
Juan Batiz-Benet
2014-10-19 07:21:02 -07:00
parent b29367a9d3
commit 4c178f87e2
2 changed files with 10 additions and 2 deletions

View File

@ -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()
}

View File

@ -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()
}