@@ -2243,8 +2243,8 @@ func testCancelNoIO(t *testing.T, e env) {
2243
2243
// The following tests the gRPC streaming RPC implementations.
2244
2244
// TODO(zhaoq): Have better coverage on error cases.
2245
2245
var (
2246
- reqSizes = []int {27182 , 8 , 1828 , 45904 }
2247
- respSizes = []int {31415 , 9 , 2653 , 58979 }
2246
+ pingPongReqSizes = []int {27182 , 8 , 1828 , 45904 }
2247
+ pingPongRespSizes = []int {31415 , 9 , 2653 , 58979 }
2248
2248
)
2249
2249
2250
2250
func TestNoService (t * testing.T ) {
@@ -2289,14 +2289,14 @@ func testPingPong(t *testing.T, e env) {
2289
2289
t .Fatalf ("%v.FullDuplexCall(_) = _, %v, want <nil>" , tc , err )
2290
2290
}
2291
2291
var index int
2292
- for index < len (reqSizes ) {
2292
+ for index < len (pingPongReqSizes ) {
2293
2293
respParam := []* testpb.ResponseParameters {
2294
2294
{
2295
- Size : proto .Int32 (int32 (respSizes [index ])),
2295
+ Size : proto .Int32 (int32 (pingPongRespSizes [index ])),
2296
2296
},
2297
2297
}
2298
2298
2299
- payload , err := newPayload (testpb .PayloadType_COMPRESSABLE , int32 (reqSizes [index ]))
2299
+ payload , err := newPayload (testpb .PayloadType_COMPRESSABLE , int32 (pingPongReqSizes [index ]))
2300
2300
if err != nil {
2301
2301
t .Fatal (err )
2302
2302
}
@@ -2318,8 +2318,8 @@ func testPingPong(t *testing.T, e env) {
2318
2318
t .Fatalf ("Got the reply of type %d, want %d" , pt , testpb .PayloadType_COMPRESSABLE )
2319
2319
}
2320
2320
size := len (reply .GetPayload ().GetBody ())
2321
- if size != int (respSizes [index ]) {
2322
- t .Fatalf ("Got reply body of length %d, want %d" , size , respSizes [index ])
2321
+ if size != int (pingPongRespSizes [index ]) {
2322
+ t .Fatalf ("Got reply body of length %d, want %d" , size , pingPongRespSizes [index ])
2323
2323
}
2324
2324
index ++
2325
2325
}
@@ -2367,14 +2367,14 @@ func testMetadataStreamingRPC(t *testing.T, e env) {
2367
2367
t .Errorf ("#2 %v.Header() = %v, %v, want %v, <nil>" , stream , headerMD , err , testMetadata )
2368
2368
}
2369
2369
var index int
2370
- for index < len (reqSizes ) {
2370
+ for index < len (pingPongReqSizes ) {
2371
2371
respParam := []* testpb.ResponseParameters {
2372
2372
{
2373
- Size : proto .Int32 (int32 (respSizes [index ])),
2373
+ Size : proto .Int32 (int32 (pingPongRespSizes [index ])),
2374
2374
},
2375
2375
}
2376
2376
2377
- payload , err := newPayload (testpb .PayloadType_COMPRESSABLE , int32 (reqSizes [index ]))
2377
+ payload , err := newPayload (testpb .PayloadType_COMPRESSABLE , int32 (pingPongReqSizes [index ]))
2378
2378
if err != nil {
2379
2379
t .Fatal (err )
2380
2380
}
@@ -2405,20 +2405,26 @@ func testMetadataStreamingRPC(t *testing.T, e env) {
2405
2405
}
2406
2406
2407
2407
func TestServerStreaming (t * testing.T ) {
2408
+ serverRespSizes := [][]int {
2409
+ {27182 , 8 , 1828 , 45904 },
2410
+ {(1 << 21 ), (1 << 21 ), (1 << 21 ), (1 << 21 ), (1 << 21 ), (1 << 21 ), (1 << 21 ), (1 << 21 )},
2411
+ }
2408
2412
defer leakCheck (t )()
2409
- for _ , e := range listTestEnv () {
2410
- testServerStreaming (t , e )
2413
+ for _ , s := range serverRespSizes {
2414
+ for _ , e := range listTestEnv () {
2415
+ testServerStreaming (t , e , s )
2416
+ }
2411
2417
}
2412
2418
}
2413
2419
2414
- func testServerStreaming (t * testing.T , e env ) {
2420
+ func testServerStreaming (t * testing.T , e env , serverRespSizes [] int ) {
2415
2421
te := newTest (t , e )
2416
2422
te .startServer (& testServer {security : e .security })
2417
2423
defer te .tearDown ()
2418
2424
tc := testpb .NewTestServiceClient (te .clientConn ())
2419
2425
2420
- respParam := make ([]* testpb.ResponseParameters , len (respSizes ))
2421
- for i , s := range respSizes {
2426
+ respParam := make ([]* testpb.ResponseParameters , len (serverRespSizes ))
2427
+ for i , s := range serverRespSizes {
2422
2428
respParam [i ] = & testpb.ResponseParameters {
2423
2429
Size : proto .Int32 (int32 (s )),
2424
2430
}
@@ -2445,17 +2451,17 @@ func testServerStreaming(t *testing.T, e env) {
2445
2451
t .Fatalf ("Got the reply of type %d, want %d" , pt , testpb .PayloadType_COMPRESSABLE )
2446
2452
}
2447
2453
size := len (reply .GetPayload ().GetBody ())
2448
- if size != int (respSizes [index ]) {
2449
- t .Fatalf ("Got reply body of length %d, want %d" , size , respSizes [index ])
2454
+ if size != int (serverRespSizes [index ]) {
2455
+ t .Fatalf ("Got reply body of length %d, want %d" , size , serverRespSizes [index ])
2450
2456
}
2451
2457
index ++
2452
2458
respCnt ++
2453
2459
}
2454
2460
if rpcStatus != io .EOF {
2455
2461
t .Fatalf ("Failed to finish the server streaming rpc: %v, want <EOF>" , rpcStatus )
2456
2462
}
2457
- if respCnt != len (respSizes ) {
2458
- t .Fatalf ("Got %d reply, want %d" , len (respSizes ), respCnt )
2463
+ if respCnt != len (serverRespSizes ) {
2464
+ t .Fatalf ("Got %d reply, want %d" , len (serverRespSizes ), respCnt )
2459
2465
}
2460
2466
}
2461
2467
@@ -2473,8 +2479,8 @@ func testFailedServerStreaming(t *testing.T, e env) {
2473
2479
defer te .tearDown ()
2474
2480
tc := testpb .NewTestServiceClient (te .clientConn ())
2475
2481
2476
- respParam := make ([]* testpb.ResponseParameters , len (respSizes ))
2477
- for i , s := range respSizes {
2482
+ respParam := make ([]* testpb.ResponseParameters , len (pingPongRespSizes ))
2483
+ for i , s := range pingPongRespSizes {
2478
2484
respParam [i ] = & testpb.ResponseParameters {
2479
2485
Size : proto .Int32 (int32 (s )),
2480
2486
}
@@ -2576,12 +2582,18 @@ func testServerStreamingConcurrent(t *testing.T, e env) {
2576
2582
2577
2583
func TestClientStreaming (t * testing.T ) {
2578
2584
defer leakCheck (t )()
2579
- for _ , e := range listTestEnv () {
2580
- testClientStreaming (t , e )
2585
+ clientReqSizes := [][]int {
2586
+ {27182 , 8 , 1828 , 45904 },
2587
+ {(1 << 21 ), (1 << 21 ), (1 << 21 ), (1 << 21 ), (1 << 21 ), (1 << 21 ), (1 << 21 ), (1 << 21 )},
2588
+ }
2589
+ for _ , s := range clientReqSizes {
2590
+ for _ , e := range listTestEnv () {
2591
+ testClientStreaming (t , e , s )
2592
+ }
2581
2593
}
2582
2594
}
2583
2595
2584
- func testClientStreaming (t * testing.T , e env ) {
2596
+ func testClientStreaming (t * testing.T , e env , clientReqSizes [] int ) {
2585
2597
te := newTest (t , e )
2586
2598
te .startServer (& testServer {security : e .security })
2587
2599
defer te .tearDown ()
@@ -2593,7 +2605,7 @@ func testClientStreaming(t *testing.T, e env) {
2593
2605
}
2594
2606
2595
2607
var sum int
2596
- for _ , s := range reqSizes {
2608
+ for _ , s := range clientReqSizes {
2597
2609
payload , err := newPayload (testpb .PayloadType_COMPRESSABLE , int32 (s ))
2598
2610
if err != nil {
2599
2611
t .Fatal (err )
0 commit comments