@@ -74,12 +74,6 @@ func TestSubscribeUnit(t *testing.T) {
7474 t .Fatal ("Couldn't start" , target )
7575 }
7676
77- timeout := make (chan bool , 1 )
78- go func () {
79- time .Sleep (3 * time .Second )
80- close (timeout )
81- }()
82-
8377 for {
8478 select {
8579 case changes := <- evChan :
@@ -95,7 +89,7 @@ func TestSubscribeUnit(t *testing.T) {
9589 }
9690 case err = <- errChan :
9791 t .Fatal (err )
98- case <- timeout :
92+ case <- time . After ( 10 * time . Second ) :
9993 t .Fatal ("Reached timeout" )
10094 }
10195 }
@@ -114,8 +108,8 @@ func TestSubStateSubscription(t *testing.T) {
114108 t .Fatal (err )
115109 }
116110
117- updateCh := make (chan * SubStateUpdate )
118- errCh := make (chan error )
111+ updateCh := make (chan * SubStateUpdate , 256 )
112+ errCh := make (chan error , 256 )
119113 conn .SetSubStateSubscriber (updateCh , errCh )
120114
121115 setupUnit (target , conn , t )
@@ -132,12 +126,6 @@ func TestSubStateSubscription(t *testing.T) {
132126 t .Fatal ("Couldn't start" , target )
133127 }
134128
135- timeout := make (chan bool , 1 )
136- go func () {
137- time .Sleep (3 * time .Second )
138- close (timeout )
139- }()
140-
141129 for {
142130 select {
143131 case update := <- updateCh :
@@ -146,7 +134,7 @@ func TestSubStateSubscription(t *testing.T) {
146134 }
147135 case err := <- errCh :
148136 t .Fatal (err )
149- case <- timeout :
137+ case <- time . After ( 10 * time . Second ) :
150138 t .Fatal ("Reached timeout" )
151139 }
152140 }
@@ -167,8 +155,8 @@ func TestPropertiesSubscription(t *testing.T) {
167155 t .Fatal (err )
168156 }
169157
170- updateCh := make (chan * PropertiesUpdate )
171- errCh := make (chan error )
158+ updateCh := make (chan * PropertiesUpdate , 256 )
159+ errCh := make (chan error , 256 )
172160 conn .SetPropertiesSubscriber (updateCh , errCh )
173161
174162 setupUnit (target , conn , t )
@@ -185,12 +173,6 @@ func TestPropertiesSubscription(t *testing.T) {
185173 t .Fatal ("Couldn't start" , target )
186174 }
187175
188- timeout := make (chan bool , 1 )
189- go func () {
190- time .Sleep (3 * time .Second )
191- close (timeout )
192- }()
193-
194176 for {
195177 select {
196178 case update := <- updateCh :
@@ -202,7 +184,7 @@ func TestPropertiesSubscription(t *testing.T) {
202184 }
203185 case err := <- errCh :
204186 t .Fatal (err )
205- case <- timeout :
187+ case <- time . After ( 10 * time . Second ) :
206188 t .Fatal ("Reached timeout" )
207189 }
208190 }
0 commit comments