@@ -163,6 +163,7 @@ func TestEmptyAddrs(t *testing.T) {
163163 time .Sleep (10 * time .Millisecond )
164164 ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Millisecond )
165165 if err := Invoke (ctx , "/foo/bar" , & expectedRequest , & reply , cc ); err != nil {
166+ cancel ()
166167 break
167168 }
168169 cancel ()
@@ -239,6 +240,7 @@ func TestCloseWithPendingRPC(t *testing.T) {
239240 for {
240241 ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Millisecond )
241242 if err := Invoke (ctx , "/foo/bar" , & expectedRequest , & reply , cc , FailFast (false )); Code (err ) == codes .DeadlineExceeded {
243+ cancel ()
242244 break
243245 }
244246 time .Sleep (10 * time .Millisecond )
@@ -466,6 +468,7 @@ func TestPickFirstEmptyAddrs(t *testing.T) {
466468 time .Sleep (10 * time .Millisecond )
467469 ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Millisecond )
468470 if err := Invoke (ctx , "/foo/bar" , & expectedRequest , & reply , cc ); err != nil {
471+ cancel ()
469472 break
470473 }
471474 cancel ()
@@ -493,6 +496,7 @@ func TestPickFirstCloseWithPendingRPC(t *testing.T) {
493496 for {
494497 ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Millisecond )
495498 if err := Invoke (ctx , "/foo/bar" , & expectedRequest , & reply , cc , FailFast (false )); Code (err ) == codes .DeadlineExceeded {
499+ cancel ()
496500 break
497501 }
498502 time .Sleep (10 * time .Millisecond )
0 commit comments