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