Skip to content

Commit 1ed10f4

Browse files
committed
Code Review Changes
1 parent dfe089c commit 1ed10f4

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

interop/client/client.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,7 @@ func main() {
267267
}
268268
defer conn.Close()
269269
tc := testgrpc.NewTestServiceClient(conn)
270-
overallDeadline := time.Now().Add(time.Duration(*soakOverallTimeoutSeconds) * time.Second)
271-
ctxWithDeadline, cancel := context.WithDeadline(ctx, overallDeadline)
270+
ctxWithDeadline, cancel := context.WithTimeout(ctx, time.Duration(*soakOverallTimeoutSeconds)*time.Second)
272271
defer cancel()
273272
switch *testCase {
274273
case "empty_unary":

interop/test_utils.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,8 @@ func DoPerRPCCreds(ctx context.Context, tc testgrpc.TestServiceClient, serviceAc
389389
}
390390
token := GetToken(ctx, serviceAccountKeyFile, oauthScope)
391391
kv := map[string]string{"authorization": token.Type() + " " + token.AccessToken}
392-
outCtx := metadata.NewOutgoingContext(ctx, metadata.MD{"authorization": []string{kv["authorization"]}})
393-
reply, err := tc.UnaryCall(outCtx, req)
392+
ctx = metadata.NewOutgoingContext(ctx, metadata.MD{"authorization": []string{kv["authorization"]}})
393+
reply, err := tc.UnaryCall(ctx, req)
394394
if err != nil {
395395
logger.Fatal("/TestService/UnaryCall RPC failed: ", err)
396396
}
@@ -524,11 +524,11 @@ func DoCustomMetadata(ctx context.Context, tc testgrpc.TestServiceClient, args .
524524
ResponseSize: int32(1),
525525
Payload: pl,
526526
}
527-
outCtx := metadata.NewOutgoingContext(ctx, customMetadata)
527+
ctx = metadata.NewOutgoingContext(ctx, customMetadata)
528528
var header, trailer metadata.MD
529529
args = append(args, grpc.Header(&header), grpc.Trailer(&trailer))
530530
reply, err := tc.UnaryCall(
531-
outCtx,
531+
ctx,
532532
req,
533533
args...,
534534
)
@@ -543,7 +543,7 @@ func DoCustomMetadata(ctx context.Context, tc testgrpc.TestServiceClient, args .
543543
validateMetadata(header, trailer)
544544

545545
// Testing with FullDuplex.
546-
stream, err := tc.FullDuplexCall(outCtx, args...)
546+
stream, err := tc.FullDuplexCall(ctx, args...)
547547
if err != nil {
548548
logger.Fatalf("%v.FullDuplexCall(_) = _, %v, want <nil>", tc, err)
549549
}

interop/xds_federation/client.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ func main() {
120120
for i := range clients {
121121
wg.Add(1)
122122
go func(c clientConfig) {
123-
overallDeadline := time.Now().Add(time.Duration(*soakOverallTimeoutSeconds) * time.Second)
124-
ctxWithDeadline, cancel := context.WithDeadline(ctx, overallDeadline)
123+
ctxWithDeadline, cancel := context.WithTimeout(ctx, time.Duration(*soakOverallTimeoutSeconds)*time.Second)
125124
defer cancel()
126125
interop.DoSoakTest(ctxWithDeadline, c.tc, c.uri, c.opts, resetChannel, *soakIterations, *soakMaxFailures, *soakRequestSize, *soakResponseSize, time.Duration(*soakPerIterationMaxAcceptableLatencyMs)*time.Millisecond, time.Duration(*soakMinTimeMsBetweenRPCs)*time.Millisecond)
127126
logger.Infof("%s test done for server: %s", *testCase, c.uri)

0 commit comments

Comments
 (0)