@cryptotaxi247 / kubo / commits / 4c178f87e

close conns directly in tests

Juan Batiz-Benet committed Oct 19, 2014 at 07:21 UTC 4c178f87e24f06d59f7b8d4a6992bd8f208fcbc9
2 files changed +10 -2
net/conn/conn_test.go
+5 -1
@@ -60,7 +60,9 @@ func TestCancel(t *testing.T) {
60 default:
61 }
62
63 - cancel()
63 + c1.Close()
64 + c2.Close()
65 + cancel() // listener
66
67 // wait to ensure other goroutines run and close things.
68 <-time.After(time.Microsecond * 10)
@@ -113,6 +115,8 @@ func TestCloseLeak(t *testing.T) {
115 <-time.After(time.Microsecond * 5)
116 }
117
118 + c1.Close()
119 + c2.Close()
120 cancel() // close the listener
121 wg.Done()
122 }
net/conn/secure_conn_test.go
+5 -1
@@ -82,7 +82,9 @@ func TestSecureCancel(t *testing.T) {
82 default:
83 }
84
85 - cancel()
85 + c1.Close()
86 + c2.Close()
87 + cancel() // listener
88
89 // wait to ensure other goroutines run and close things.
90 <-time.After(time.Microsecond * 10)
@@ -137,6 +139,8 @@ func TestSecureCloseLeak(t *testing.T) {
139 <-time.After(time.Microsecond * 5)
140 }
141
142 + c1.Close()
143 + c2.Close()
144 cancel() // close the listener
145 wg.Done()
146 }