Skip to content

Commit e41e411

Browse files
committed
use SendContext to ensure no goroutine leaks
1 parent 7c9f578 commit e41e411

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

xds/internal/xdsclient/tests/ads_stream_ack_nack_test.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ func (s) TestADS_ACK_NACK_Simple(t *testing.T) {
6464
return nil
6565
},
6666
OnStreamResponse: func(_ context.Context, _ int64, _ *v3discoverypb.DiscoveryRequest, resp *v3discoverypb.DiscoveryResponse) {
67-
// The go-control-plane management server continuously resends the
68-
// same resource if NACKed by the client. Hence, we need to use
69-
// `Replace` here instead of `Send`.
70-
streamResponseCh.Replace(resp)
67+
streamResponseCh.SendContext(ctx, resp)
7168
},
7269
})
7370

@@ -246,7 +243,7 @@ func (s) TestADS_ACK_NACK_InvalidFirstResponse(t *testing.T) {
246243
return nil
247244
},
248245
OnStreamResponse: func(_ context.Context, _ int64, _ *v3discoverypb.DiscoveryRequest, resp *v3discoverypb.DiscoveryResponse) {
249-
streamResponseCh.Send(resp)
246+
streamResponseCh.SendContext(ctx, resp)
250247
},
251248
})
252249

@@ -351,7 +348,7 @@ func (s) TestADS_ACK_NACK_ResourceIsNotRequestedAnymore(t *testing.T) {
351348
return nil
352349
},
353350
OnStreamResponse: func(_ context.Context, _ int64, _ *v3discoverypb.DiscoveryRequest, resp *v3discoverypb.DiscoveryResponse) {
354-
streamResponseCh.Send(resp)
351+
streamResponseCh.SendContext(ctx, resp)
355352
},
356353
})
357354

0 commit comments

Comments
 (0)