@@ -337,6 +337,9 @@ func (s *server) start(t *testing.T, port int, serverConfig *ServerConfig, ht hT
337
337
return
338
338
}
339
339
rawConn := conn
340
+ if serverConfig .MaxStreams == 0 {
341
+ serverConfig .MaxStreams = math .MaxUint32
342
+ }
340
343
transport , err := NewServerTransport (conn , serverConfig )
341
344
if err != nil {
342
345
return
@@ -425,8 +428,8 @@ func setUpServerOnly(t *testing.T, port int, sc *ServerConfig, ht hType) *server
425
428
return server
426
429
}
427
430
428
- func setUp (t * testing.T , port int , maxStreams uint32 , ht hType ) (* server , * http2Client , func ()) {
429
- return setUpWithOptions (t , port , & ServerConfig {MaxStreams : maxStreams }, ht , ConnectOptions {})
431
+ func setUp (t * testing.T , port int , ht hType ) (* server , * http2Client , func ()) {
432
+ return setUpWithOptions (t , port , & ServerConfig {}, ht , ConnectOptions {})
430
433
}
431
434
432
435
func setUpWithOptions (t * testing.T , port int , sc * ServerConfig , ht hType , copts ConnectOptions ) (* server , * http2Client , func ()) {
@@ -521,7 +524,7 @@ func (s) TestInflightStreamClosing(t *testing.T) {
521
524
522
525
// Tests that when streamID > MaxStreamId, the current client transport drains.
523
526
func (s ) TestClientTransportDrainsAfterStreamIDExhausted (t * testing.T ) {
524
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
527
+ server , ct , cancel := setUp (t , 0 , normal )
525
528
defer cancel ()
526
529
defer server .stop ()
527
530
callHdr := & CallHdr {
@@ -566,7 +569,7 @@ func (s) TestClientTransportDrainsAfterStreamIDExhausted(t *testing.T) {
566
569
}
567
570
568
571
func (s ) TestClientSendAndReceive (t * testing.T ) {
569
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
572
+ server , ct , cancel := setUp (t , 0 , normal )
570
573
defer cancel ()
571
574
callHdr := & CallHdr {
572
575
Host : "localhost" ,
@@ -606,7 +609,7 @@ func (s) TestClientSendAndReceive(t *testing.T) {
606
609
}
607
610
608
611
func (s ) TestClientErrorNotify (t * testing.T ) {
609
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
612
+ server , ct , cancel := setUp (t , 0 , normal )
610
613
defer cancel ()
611
614
go server .stop ()
612
615
// ct.reader should detect the error and activate ct.Error().
@@ -640,7 +643,7 @@ func performOneRPC(ct ClientTransport) {
640
643
}
641
644
642
645
func (s ) TestClientMix (t * testing.T ) {
643
- s , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
646
+ s , ct , cancel := setUp (t , 0 , normal )
644
647
defer cancel ()
645
648
time .AfterFunc (time .Second , s .stop )
646
649
go func (ct ClientTransport ) {
@@ -654,7 +657,7 @@ func (s) TestClientMix(t *testing.T) {
654
657
}
655
658
656
659
func (s ) TestLargeMessage (t * testing.T ) {
657
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
660
+ server , ct , cancel := setUp (t , 0 , normal )
658
661
defer cancel ()
659
662
callHdr := & CallHdr {
660
663
Host : "localhost" ,
@@ -789,7 +792,7 @@ func (s) TestLargeMessageWithDelayRead(t *testing.T) {
789
792
// proceed until they complete naturally, while not allowing creation of new
790
793
// streams during this window.
791
794
func (s ) TestGracefulClose (t * testing.T ) {
792
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , pingpong )
795
+ server , ct , cancel := setUp (t , 0 , pingpong )
793
796
defer cancel ()
794
797
defer func () {
795
798
// Stop the server's listener to make the server's goroutines terminate
@@ -855,7 +858,7 @@ func (s) TestGracefulClose(t *testing.T) {
855
858
}
856
859
857
860
func (s ) TestLargeMessageSuspension (t * testing.T ) {
858
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , suspended )
861
+ server , ct , cancel := setUp (t , 0 , suspended )
859
862
defer cancel ()
860
863
callHdr := & CallHdr {
861
864
Host : "localhost" ,
@@ -963,7 +966,7 @@ func (s) TestMaxStreams(t *testing.T) {
963
966
}
964
967
965
968
func (s ) TestServerContextCanceledOnClosedConnection (t * testing.T ) {
966
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , suspended )
969
+ server , ct , cancel := setUp (t , 0 , suspended )
967
970
defer cancel ()
968
971
callHdr := & CallHdr {
969
972
Host : "localhost" ,
@@ -1435,7 +1438,7 @@ func (s) TestClientWithMisbehavedServer(t *testing.T) {
1435
1438
var encodingTestStatus = status .New (codes .Internal , "\n " )
1436
1439
1437
1440
func (s ) TestEncodingRequiredStatus (t * testing.T ) {
1438
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , encodingRequiredStatus )
1441
+ server , ct , cancel := setUp (t , 0 , encodingRequiredStatus )
1439
1442
defer cancel ()
1440
1443
callHdr := & CallHdr {
1441
1444
Host : "localhost" ,
@@ -1463,7 +1466,7 @@ func (s) TestEncodingRequiredStatus(t *testing.T) {
1463
1466
}
1464
1467
1465
1468
func (s ) TestInvalidHeaderField (t * testing.T ) {
1466
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , invalidHeaderField )
1469
+ server , ct , cancel := setUp (t , 0 , invalidHeaderField )
1467
1470
defer cancel ()
1468
1471
callHdr := & CallHdr {
1469
1472
Host : "localhost" ,
@@ -1485,7 +1488,7 @@ func (s) TestInvalidHeaderField(t *testing.T) {
1485
1488
}
1486
1489
1487
1490
func (s ) TestHeaderChanClosedAfterReceivingAnInvalidHeader (t * testing.T ) {
1488
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , invalidHeaderField )
1491
+ server , ct , cancel := setUp (t , 0 , invalidHeaderField )
1489
1492
defer cancel ()
1490
1493
defer server .stop ()
1491
1494
defer ct .Close (fmt .Errorf ("closed manually by test" ))
@@ -2153,7 +2156,7 @@ func (s) TestPingPong1MB(t *testing.T) {
2153
2156
2154
2157
// This is a stress-test of flow control logic.
2155
2158
func runPingPongTest (t * testing.T , msgSize int ) {
2156
- server , client , cancel := setUp (t , 0 , 0 , pingpong )
2159
+ server , client , cancel := setUp (t , 0 , pingpong )
2157
2160
defer cancel ()
2158
2161
defer server .stop ()
2159
2162
defer client .Close (fmt .Errorf ("closed manually by test" ))
@@ -2235,7 +2238,7 @@ func (s) TestHeaderTblSize(t *testing.T) {
2235
2238
}
2236
2239
}()
2237
2240
2238
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
2241
+ server , ct , cancel := setUp (t , 0 , normal )
2239
2242
defer cancel ()
2240
2243
defer ct .Close (fmt .Errorf ("closed manually by test" ))
2241
2244
defer server .stop ()
@@ -2594,7 +2597,7 @@ func TestConnectionError_Unwrap(t *testing.T) {
2594
2597
2595
2598
func (s ) TestPeerSetInServerContext (t * testing.T ) {
2596
2599
// create client and server transports.
2597
- server , client , cancel := setUp (t , 0 , math . MaxUint32 , normal )
2600
+ server , client , cancel := setUp (t , 0 , normal )
2598
2601
defer cancel ()
2599
2602
defer server .stop ()
2600
2603
defer client .Close (fmt .Errorf ("closed manually by test" ))
0 commit comments