Skip to content

Commit

Permalink
close conns directly in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jbenet committed Oct 19, 2014
1 parent b29367a commit 4c178f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion net/conn/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -113,6 +115,8 @@ func TestCloseLeak(t *testing.T) {
<-time.After(time.Microsecond * 5)
}

c1.Close()
c2.Close()
cancel() // close the listener
wg.Done()
}
Expand Down
6 changes: 5 additions & 1 deletion net/conn/secure_conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -137,6 +139,8 @@ func TestSecureCloseLeak(t *testing.T) {
<-time.After(time.Microsecond * 5)
}

c1.Close()
c2.Close()
cancel() // close the listener
wg.Done()
}
Expand Down

0 comments on commit 4c178f8

Please sign in to comment.