@@ -196,7 +196,7 @@ func channelIDHashRoute(routeName, virtualHostDomain, clusterName string) *v3rou
196196// checkRPCSendOK sends num RPCs to the client. It returns a map of backend
197197// addresses as keys and number of RPCs sent to this address as value. Abort the
198198// test if any RPC fails.
199- func checkRPCSendOK (t * testing. T , ctx context. Context , client testgrpc.TestServiceClient , num int ) map [string ]int {
199+ func checkRPCSendOK (ctx context. Context , t * testing. T , client testgrpc.TestServiceClient , num int ) map [string ]int {
200200 t .Helper ()
201201
202202 backendCount := make (map [string ]int )
@@ -334,7 +334,7 @@ func (s) TestRingHash_AggregateClusterFallBackFromRingHashAtStartup(t *testing.T
334334 defer conn .Close ()
335335 client := testgrpc .NewTestServiceClient (conn )
336336
337- gotPerBackend := checkRPCSendOK (t , ctx , client , 100 )
337+ gotPerBackend := checkRPCSendOK (ctx , t , client , 100 )
338338
339339 // Since this is using ring hash with the channel ID as the key, all RPCs
340340 // are routed to the same backend of the secondary locality.
@@ -441,7 +441,7 @@ func (s) TestRingHash_AggregateClusterFallBackFromRingHashToLogicalDnsAtStartup(
441441 defer conn .Close ()
442442 client := testgrpc .NewTestServiceClient (conn )
443443
444- gotPerBackend := checkRPCSendOK (t , ctx , client , 1 )
444+ gotPerBackend := checkRPCSendOK (ctx , t , client , 1 )
445445 var got string
446446 for got = range gotPerBackend {
447447 }
@@ -622,7 +622,7 @@ func (s) TestRingHash_ChannelIdHashing(t *testing.T) {
622622 defer conn .Close ()
623623 client := testgrpc .NewTestServiceClient (conn )
624624
625- received := checkRPCSendOK (t , ctx , client , 100 )
625+ received := checkRPCSendOK (ctx , t , client , 100 )
626626 if len (received ) != 1 {
627627 t .Errorf ("Got RPCs routed to %v backends, want %v" , len (received ), 1 )
628628 }
@@ -707,7 +707,7 @@ func (s) TestRingHash_HeaderHashing(t *testing.T) {
707707 // create the entry in the ring.
708708 for _ , backend := range backends {
709709 ctx := metadata .NewOutgoingContext (ctx , metadata .Pairs ("address_hash" , backend .Address + "_0" ))
710- reqPerBackend := checkRPCSendOK (t , ctx , client , 1 )
710+ reqPerBackend := checkRPCSendOK (ctx , t , client , 1 )
711711 if reqPerBackend [backend .Address ] != 1 {
712712 t .Errorf ("Got RPC routed to backend %v, want %v" , reqPerBackend , backend .Address )
713713 }
@@ -782,7 +782,7 @@ func (s) TestRingHash_HeaderHashingWithRegexRewrite(t *testing.T) {
782782 gotPerBackend := make (map [string ]int )
783783 for _ , backend := range backends {
784784 ctx := metadata .NewOutgoingContext (ctx , metadata .Pairs ("address_hash" , backend .Address + "_0" ))
785- res := checkRPCSendOK (t , ctx , client , 100 )
785+ res := checkRPCSendOK (ctx , t , client , 100 )
786786 for addr , count := range res {
787787 gotPerBackend [addr ] += count
788788 }
@@ -882,7 +882,7 @@ func (s) TestRingHash_NoHashPolicy(t *testing.T) {
882882 client := testgrpc .NewTestServiceClient (conn )
883883
884884 // Send a large number of RPCs and check that they are distributed randomly.
885- gotPerBackend := checkRPCSendOK (t , ctx , client , numRPCs )
885+ gotPerBackend := checkRPCSendOK (ctx , t , client , numRPCs )
886886 for _ , backend := range backends {
887887 got := float64 (gotPerBackend [backend .Address ]) / float64 (numRPCs )
888888 want := .5
@@ -947,7 +947,7 @@ func (s) TestRingHash_EndpointWeights(t *testing.T) {
947947
948948 // Send a large number of RPCs and check that they are distributed randomly.
949949 numRPCs := computeIdealNumberOfRPCs (t , .25 , errorTolerance )
950- gotPerBackend := checkRPCSendOK (t , ctx , client , numRPCs )
950+ gotPerBackend := checkRPCSendOK (ctx , t , client , numRPCs )
951951
952952 got := float64 (gotPerBackend [backends [0 ].Address ]) / float64 (numRPCs )
953953 want := .25
0 commit comments