Add routine leak checks

To find out routine leak source.
This commit is contained in:
Atsushi Watanabe
2020-06-26 21:01:06 +09:00
committed by Sean DuBois
parent d64ae4c32f
commit ab4eba1707
2 changed files with 26 additions and 1 deletions

View File

@@ -30,6 +30,9 @@ func (m *mockPacketConn) SetReadDeadline(t time.Time) error {
func (m *mockPacketConn) SetWriteDeadline(t time.Time) error { return nil }
func TestPairSearch(t *testing.T) {
report := test.CheckRoutines(t)
defer report()
// Limit runtime in case of deadlocks
lim := test.TimeOut(time.Second * 10)
defer lim.Stop()
@@ -55,6 +58,9 @@ func TestPairSearch(t *testing.T) {
}
func TestPairPriority(t *testing.T) {
report := test.CheckRoutines(t)
defer report()
// avoid deadlocks?
defer test.TimeOut(1 * time.Second).Stop()
@@ -142,6 +148,9 @@ func TestPairPriority(t *testing.T) {
}
func TestOnSelectedCandidatePairChange(t *testing.T) {
report := test.CheckRoutines(t)
defer report()
// avoid deadlocks?
defer test.TimeOut(1 * time.Second).Stop()
@@ -220,7 +229,7 @@ func runAgentTest(t *testing.T, config *AgentConfig, task func(a *Agent)) {
func TestHandlePeerReflexive(t *testing.T) {
// Limit runtime in case of deadlocks
lim := test.TimeOut(time.Second * 2)
lim := test.TimeOut(time.Second * 30)
defer lim.Stop()
report := test.CheckRoutines(t)