Skip to content

Commit

Permalink
xdsclient/e2e_test: use SendContext() where appropriate (#5729)
Browse files Browse the repository at this point in the history
  • Loading branch information
easwars committed Nov 2, 2022
1 parent 0d6481f commit 040b795
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xds/internal/xdsclient/e2e_test/cds_watchers_test.go
Expand Up @@ -766,8 +766,10 @@ func (s) TestCDSWatch_NACKError(t *testing.T) {
// Register a watch for a cluster resource and have the watch
// callback push the received update on to a channel.
updateCh := testutils.NewChannel()
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
cdsCancel := client.WatchCluster(cdsName, func(u xdsresource.ClusterUpdate, err error) {
updateCh.Send(xdsresource.ClusterUpdateErrTuple{Update: u, Err: err})
updateCh.SendContext(ctx, xdsresource.ClusterUpdateErrTuple{Update: u, Err: err})
})
defer cdsCancel()

Expand All @@ -778,8 +780,6 @@ func (s) TestCDSWatch_NACKError(t *testing.T) {
Clusters: []*v3clusterpb.Cluster{badClusterResource(cdsName, edsName, e2e.SecurityLevelNone)},
SkipValidation: true,
}
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if err := mgmtServer.Update(ctx, resources); err != nil {
t.Fatalf("Failed to update management server with resources: %v, err: %v", resources, err)
}
Expand Down

0 comments on commit 040b795

Please sign in to comment.