@@ -336,6 +336,9 @@ func (s *server) start(t *testing.T, port int, serverConfig *ServerConfig, ht hT
336
336
if err != nil {
337
337
return
338
338
}
339
+ if serverConfig .MaxStreams == 0 {
340
+ serverConfig .MaxStreams = math .MaxUint32
341
+ }
339
342
transport , err := NewServerTransport (conn , serverConfig )
340
343
if err != nil {
341
344
return
@@ -442,8 +445,8 @@ func setUpServerOnly(t *testing.T, port int, sc *ServerConfig, ht hType) *server
442
445
return server
443
446
}
444
447
445
- func setUp (t * testing.T , port int , maxStreams uint32 , ht hType ) (* server , * http2Client , func ()) {
446
- return setUpWithOptions (t , port , & ServerConfig {MaxStreams : maxStreams }, ht , ConnectOptions {})
448
+ func setUp (t * testing.T , port int , ht hType ) (* server , * http2Client , func ()) {
449
+ return setUpWithOptions (t , port , & ServerConfig {}, ht , ConnectOptions {})
447
450
}
448
451
449
452
func setUpWithOptions (t * testing.T , port int , sc * ServerConfig , ht hType , copts ConnectOptions ) (* server , * http2Client , func ()) {
@@ -538,7 +541,7 @@ func (s) TestInflightStreamClosing(t *testing.T) {
538
541
539
542
// Tests that when streamID > MaxStreamId, the current client transport drains.
540
543
func (s ) TestClientTransportDrainsAfterStreamIDExhausted (t * testing.T ) {
541
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
544
+ server , ct , cancel := setUp (t , 0 , normal )
542
545
defer cancel ()
543
546
defer server .stop ()
544
547
callHdr := & CallHdr {
@@ -583,7 +586,7 @@ func (s) TestClientTransportDrainsAfterStreamIDExhausted(t *testing.T) {
583
586
}
584
587
585
588
func (s ) TestClientSendAndReceive (t * testing.T ) {
586
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
589
+ server , ct , cancel := setUp (t , 0 , normal )
587
590
defer cancel ()
588
591
callHdr := & CallHdr {
589
592
Host : "localhost" ,
@@ -623,7 +626,7 @@ func (s) TestClientSendAndReceive(t *testing.T) {
623
626
}
624
627
625
628
func (s ) TestClientErrorNotify (t * testing.T ) {
626
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
629
+ server , ct , cancel := setUp (t , 0 , normal )
627
630
defer cancel ()
628
631
go server .stop ()
629
632
// ct.reader should detect the error and activate ct.Error().
@@ -657,7 +660,7 @@ func performOneRPC(ct ClientTransport) {
657
660
}
658
661
659
662
func (s ) TestClientMix (t * testing.T ) {
660
- s , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
663
+ s , ct , cancel := setUp (t , 0 , normal )
661
664
defer cancel ()
662
665
time .AfterFunc (time .Second , s .stop )
663
666
go func (ct ClientTransport ) {
@@ -671,7 +674,7 @@ func (s) TestClientMix(t *testing.T) {
671
674
}
672
675
673
676
func (s ) TestLargeMessage (t * testing.T ) {
674
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
677
+ server , ct , cancel := setUp (t , 0 , normal )
675
678
defer cancel ()
676
679
callHdr := & CallHdr {
677
680
Host : "localhost" ,
@@ -806,7 +809,7 @@ func (s) TestLargeMessageWithDelayRead(t *testing.T) {
806
809
// proceed until they complete naturally, while not allowing creation of new
807
810
// streams during this window.
808
811
func (s ) TestGracefulClose (t * testing.T ) {
809
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , pingpong )
812
+ server , ct , cancel := setUp (t , 0 , pingpong )
810
813
defer cancel ()
811
814
defer func () {
812
815
// Stop the server's listener to make the server's goroutines terminate
@@ -872,7 +875,7 @@ func (s) TestGracefulClose(t *testing.T) {
872
875
}
873
876
874
877
func (s ) TestLargeMessageSuspension (t * testing.T ) {
875
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , suspended )
878
+ server , ct , cancel := setUp (t , 0 , suspended )
876
879
defer cancel ()
877
880
callHdr := & CallHdr {
878
881
Host : "localhost" ,
@@ -980,7 +983,7 @@ func (s) TestMaxStreams(t *testing.T) {
980
983
}
981
984
982
985
func (s ) TestServerContextCanceledOnClosedConnection (t * testing.T ) {
983
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , suspended )
986
+ server , ct , cancel := setUp (t , 0 , suspended )
984
987
defer cancel ()
985
988
callHdr := & CallHdr {
986
989
Host : "localhost" ,
@@ -1452,7 +1455,7 @@ func (s) TestClientWithMisbehavedServer(t *testing.T) {
1452
1455
var encodingTestStatus = status .New (codes .Internal , "\n " )
1453
1456
1454
1457
func (s ) TestEncodingRequiredStatus (t * testing.T ) {
1455
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , encodingRequiredStatus )
1458
+ server , ct , cancel := setUp (t , 0 , encodingRequiredStatus )
1456
1459
defer cancel ()
1457
1460
callHdr := & CallHdr {
1458
1461
Host : "localhost" ,
@@ -1480,7 +1483,7 @@ func (s) TestEncodingRequiredStatus(t *testing.T) {
1480
1483
}
1481
1484
1482
1485
func (s ) TestInvalidHeaderField (t * testing.T ) {
1483
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , invalidHeaderField )
1486
+ server , ct , cancel := setUp (t , 0 , invalidHeaderField )
1484
1487
defer cancel ()
1485
1488
callHdr := & CallHdr {
1486
1489
Host : "localhost" ,
@@ -1502,7 +1505,7 @@ func (s) TestInvalidHeaderField(t *testing.T) {
1502
1505
}
1503
1506
1504
1507
func (s ) TestHeaderChanClosedAfterReceivingAnInvalidHeader (t * testing.T ) {
1505
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , invalidHeaderField )
1508
+ server , ct , cancel := setUp (t , 0 , invalidHeaderField )
1506
1509
defer cancel ()
1507
1510
defer server .stop ()
1508
1511
defer ct .Close (fmt .Errorf ("closed manually by test" ))
@@ -2170,7 +2173,7 @@ func (s) TestPingPong1MB(t *testing.T) {
2170
2173
2171
2174
// This is a stress-test of flow control logic.
2172
2175
func runPingPongTest (t * testing.T , msgSize int ) {
2173
- server , client , cancel := setUp (t , 0 , 0 , pingpong )
2176
+ server , client , cancel := setUp (t , 0 , pingpong )
2174
2177
defer cancel ()
2175
2178
defer server .stop ()
2176
2179
defer client .Close (fmt .Errorf ("closed manually by test" ))
@@ -2252,7 +2255,7 @@ func (s) TestHeaderTblSize(t *testing.T) {
2252
2255
}
2253
2256
}()
2254
2257
2255
- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
2258
+ server , ct , cancel := setUp (t , 0 , normal )
2256
2259
defer cancel ()
2257
2260
defer ct .Close (fmt .Errorf ("closed manually by test" ))
2258
2261
defer server .stop ()
@@ -2611,7 +2614,7 @@ func TestConnectionError_Unwrap(t *testing.T) {
2611
2614
2612
2615
func (s ) TestPeerSetInServerContext (t * testing.T ) {
2613
2616
// create client and server transports.
2614
- server , client , cancel := setUp (t , 0 , math . MaxUint32 , normal )
2617
+ server , client , cancel := setUp (t , 0 , normal )
2615
2618
defer cancel ()
2616
2619
defer server .stop ()
2617
2620
defer client .Close (fmt .Errorf ("closed manually by test" ))
0 commit comments