call cancel on context in DoTimeoutOnSleepingServer

This commit is contained in:
Menghan Li 2017-01-05 13:01:42 -08:00
parent c810507164
commit ec1de5b416
1 changed files with 2 additions and 1 deletions

View File

@ -240,7 +240,8 @@ func DoEmptyStream(tc testpb.TestServiceClient, args ...grpc.CallOption) {
// DoTimeoutOnSleepingServer performs an RPC on a sleep server which causes RPC timeout.
func DoTimeoutOnSleepingServer(tc testpb.TestServiceClient, args ...grpc.CallOption) {
ctx, _ := context.WithTimeout(context.Background(), 1*time.Millisecond)
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Millisecond)
defer cancel()
stream, err := tc.FullDuplexCall(ctx, args...)
if err != nil {
if grpc.Code(err) == codes.DeadlineExceeded {