Skip to content

Commit 6c25072

Browse files
committed
rename ctxWithTimeout to ctx
1 parent cb43ba0 commit 6c25072

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

internal/xds/rbac/rbac_engine_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,13 +1747,13 @@ func (s) TestChainEngine(t *testing.T) {
17471747
// if the chain of RBAC Engines configured as such works as intended.
17481748
for _, data := range test.rbacQueries {
17491749
func() {
1750-
ctxWithTimeout, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
1750+
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
17511751
defer cancel()
17521752
// Construct the context with three data points that have enough
17531753
// information to represent incoming RPC's. This will be how a
17541754
// user uses this API. A user will have to put MD, PeerInfo, and
17551755
// the connection the RPC is sent on in the context.
1756-
ctx := metadata.NewIncomingContext(ctxWithTimeout, data.rpcData.md)
1756+
ctx = metadata.NewIncomingContext(ctx, data.rpcData.md)
17571757
// Make a TCP connection with a certain destination port. The
17581758
// address/port of this connection will be used to populate the
17591759
// destination ip/port in RPCData struct. This represents what

metadata/metadata_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131

3232
const defaultTestTimeout = 10 * time.Second
3333

34-
var ctxWithTimeout, cancel = context.WithTimeout(context.Background(), defaultTestTimeout)
34+
var ctx, cancel = context.WithTimeout(context.Background(), defaultTestTimeout)
3535

3636
type s struct {
3737
grpctest.Tester
@@ -207,7 +207,7 @@ func (s) TestFromIncomingContext(t *testing.T) {
207207
)
208208
// Verify that we lowercase if callers directly modify md
209209
md["X-INCORRECT-UPPERCASE"] = []string{"foo"}
210-
ctx := NewIncomingContext(ctxWithTimeout, md)
210+
ctx := NewIncomingContext(ctx, md)
211211
defer cancel()
212212

213213
result, found := FromIncomingContext(ctx)
@@ -244,7 +244,7 @@ func (s) TestValueFromIncomingContext(t *testing.T) {
244244
)
245245
// Verify that we lowercase if callers directly modify md
246246
md["X-INCORRECT-UPPERCASE"] = []string{"foo"}
247-
ctx := NewIncomingContext(ctxWithTimeout, md)
247+
ctx := NewIncomingContext(ctx, md)
248248
defer cancel()
249249

250250
for _, test := range []struct {
@@ -402,7 +402,7 @@ func BenchmarkFromOutgoingContext(b *testing.B) {
402402

403403
func BenchmarkFromIncomingContext(b *testing.B) {
404404
md := Pairs("X-My-Header-1", "42")
405-
ctx := NewIncomingContext(ctxWithTimeout, md)
405+
ctx := NewIncomingContext(ctx, md)
406406
defer cancel()
407407

408408
b.ResetTimer()
@@ -413,7 +413,7 @@ func BenchmarkFromIncomingContext(b *testing.B) {
413413

414414
func BenchmarkValueFromIncomingContext(b *testing.B) {
415415
md := Pairs("X-My-Header-1", "42")
416-
ctx := NewIncomingContext(ctxWithTimeout, md)
416+
ctx := NewIncomingContext(ctx, md)
417417
defer cancel()
418418

419419
b.Run("key-found", func(b *testing.B) {

peer/peer_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ func TestPeerStringer(t *testing.T) {
8585
}
8686
for _, tc := range testCases {
8787
t.Run(tc.name, func(t *testing.T) {
88-
ctxWithTimeout, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
88+
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
8989
defer cancel()
90-
ctx := NewContext(ctxWithTimeout, tc.peer)
90+
ctx = NewContext(ctx, tc.peer)
9191

9292
p, ok := FromContext(ctx)
9393
if !ok {

0 commit comments

Comments
 (0)