@@ -337,6 +337,9 @@ func (s *server) start(t *testing.T, port int, serverConfig *ServerConfig, ht hT
337337 return
338338 }
339339 rawConn := conn
340+ if serverConfig .MaxStreams == 0 {
341+ serverConfig .MaxStreams = math .MaxUint32
342+ }
340343 transport , err := NewServerTransport (conn , serverConfig )
341344 if err != nil {
342345 return
@@ -425,8 +428,8 @@ func setUpServerOnly(t *testing.T, port int, sc *ServerConfig, ht hType) *server
425428 return server
426429}
427430
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 {})
430433}
431434
432435func 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) {
521524
522525// Tests that when streamID > MaxStreamId, the current client transport drains.
523526func (s ) TestClientTransportDrainsAfterStreamIDExhausted (t * testing.T ) {
524- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
527+ server , ct , cancel := setUp (t , 0 , normal )
525528 defer cancel ()
526529 defer server .stop ()
527530 callHdr := & CallHdr {
@@ -566,7 +569,7 @@ func (s) TestClientTransportDrainsAfterStreamIDExhausted(t *testing.T) {
566569}
567570
568571func (s ) TestClientSendAndReceive (t * testing.T ) {
569- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
572+ server , ct , cancel := setUp (t , 0 , normal )
570573 defer cancel ()
571574 callHdr := & CallHdr {
572575 Host : "localhost" ,
@@ -606,7 +609,7 @@ func (s) TestClientSendAndReceive(t *testing.T) {
606609}
607610
608611func (s ) TestClientErrorNotify (t * testing.T ) {
609- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
612+ server , ct , cancel := setUp (t , 0 , normal )
610613 defer cancel ()
611614 go server .stop ()
612615 // ct.reader should detect the error and activate ct.Error().
@@ -640,7 +643,7 @@ func performOneRPC(ct ClientTransport) {
640643}
641644
642645func (s ) TestClientMix (t * testing.T ) {
643- s , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
646+ s , ct , cancel := setUp (t , 0 , normal )
644647 defer cancel ()
645648 time .AfterFunc (time .Second , s .stop )
646649 go func (ct ClientTransport ) {
@@ -654,7 +657,7 @@ func (s) TestClientMix(t *testing.T) {
654657}
655658
656659func (s ) TestLargeMessage (t * testing.T ) {
657- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
660+ server , ct , cancel := setUp (t , 0 , normal )
658661 defer cancel ()
659662 callHdr := & CallHdr {
660663 Host : "localhost" ,
@@ -789,7 +792,7 @@ func (s) TestLargeMessageWithDelayRead(t *testing.T) {
789792// proceed until they complete naturally, while not allowing creation of new
790793// streams during this window.
791794func (s ) TestGracefulClose (t * testing.T ) {
792- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , pingpong )
795+ server , ct , cancel := setUp (t , 0 , pingpong )
793796 defer cancel ()
794797 defer func () {
795798 // Stop the server's listener to make the server's goroutines terminate
@@ -855,7 +858,7 @@ func (s) TestGracefulClose(t *testing.T) {
855858}
856859
857860func (s ) TestLargeMessageSuspension (t * testing.T ) {
858- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , suspended )
861+ server , ct , cancel := setUp (t , 0 , suspended )
859862 defer cancel ()
860863 callHdr := & CallHdr {
861864 Host : "localhost" ,
@@ -963,7 +966,7 @@ func (s) TestMaxStreams(t *testing.T) {
963966}
964967
965968func (s ) TestServerContextCanceledOnClosedConnection (t * testing.T ) {
966- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , suspended )
969+ server , ct , cancel := setUp (t , 0 , suspended )
967970 defer cancel ()
968971 callHdr := & CallHdr {
969972 Host : "localhost" ,
@@ -1435,7 +1438,7 @@ func (s) TestClientWithMisbehavedServer(t *testing.T) {
14351438var encodingTestStatus = status .New (codes .Internal , "\n " )
14361439
14371440func (s ) TestEncodingRequiredStatus (t * testing.T ) {
1438- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , encodingRequiredStatus )
1441+ server , ct , cancel := setUp (t , 0 , encodingRequiredStatus )
14391442 defer cancel ()
14401443 callHdr := & CallHdr {
14411444 Host : "localhost" ,
@@ -1463,7 +1466,7 @@ func (s) TestEncodingRequiredStatus(t *testing.T) {
14631466}
14641467
14651468func (s ) TestInvalidHeaderField (t * testing.T ) {
1466- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , invalidHeaderField )
1469+ server , ct , cancel := setUp (t , 0 , invalidHeaderField )
14671470 defer cancel ()
14681471 callHdr := & CallHdr {
14691472 Host : "localhost" ,
@@ -1485,7 +1488,7 @@ func (s) TestInvalidHeaderField(t *testing.T) {
14851488}
14861489
14871490func (s ) TestHeaderChanClosedAfterReceivingAnInvalidHeader (t * testing.T ) {
1488- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , invalidHeaderField )
1491+ server , ct , cancel := setUp (t , 0 , invalidHeaderField )
14891492 defer cancel ()
14901493 defer server .stop ()
14911494 defer ct .Close (fmt .Errorf ("closed manually by test" ))
@@ -2153,7 +2156,7 @@ func (s) TestPingPong1MB(t *testing.T) {
21532156
21542157// This is a stress-test of flow control logic.
21552158func runPingPongTest (t * testing.T , msgSize int ) {
2156- server , client , cancel := setUp (t , 0 , 0 , pingpong )
2159+ server , client , cancel := setUp (t , 0 , pingpong )
21572160 defer cancel ()
21582161 defer server .stop ()
21592162 defer client .Close (fmt .Errorf ("closed manually by test" ))
@@ -2235,7 +2238,7 @@ func (s) TestHeaderTblSize(t *testing.T) {
22352238 }
22362239 }()
22372240
2238- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
2241+ server , ct , cancel := setUp (t , 0 , normal )
22392242 defer cancel ()
22402243 defer ct .Close (fmt .Errorf ("closed manually by test" ))
22412244 defer server .stop ()
@@ -2594,7 +2597,7 @@ func TestConnectionError_Unwrap(t *testing.T) {
25942597
25952598func (s ) TestPeerSetInServerContext (t * testing.T ) {
25962599 // create client and server transports.
2597- server , client , cancel := setUp (t , 0 , math . MaxUint32 , normal )
2600+ server , client , cancel := setUp (t , 0 , normal )
25982601 defer cancel ()
25992602 defer server .stop ()
26002603 defer client .Close (fmt .Errorf ("closed manually by test" ))
0 commit comments