@@ -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
@@ -443,8 +446,8 @@ func setUpServerOnly(t *testing.T, port int, sc *ServerConfig, ht hType) *server
443446 return server
444447}
445448
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 {})
448451}
449452
450453func 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) {
539542
540543// Tests that when streamID > MaxStreamId, the current client transport drains.
541544func (s ) TestClientTransportDrainsAfterStreamIDExhausted (t * testing.T ) {
542- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
545+ server , ct , cancel := setUp (t , 0 , normal )
543546 defer cancel ()
544547 defer server .stop ()
545548 callHdr := & CallHdr {
@@ -584,7 +587,7 @@ func (s) TestClientTransportDrainsAfterStreamIDExhausted(t *testing.T) {
584587}
585588
586589func (s ) TestClientSendAndReceive (t * testing.T ) {
587- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
590+ server , ct , cancel := setUp (t , 0 , normal )
588591 defer cancel ()
589592 callHdr := & CallHdr {
590593 Host : "localhost" ,
@@ -624,7 +627,7 @@ func (s) TestClientSendAndReceive(t *testing.T) {
624627}
625628
626629func (s ) TestClientErrorNotify (t * testing.T ) {
627- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
630+ server , ct , cancel := setUp (t , 0 , normal )
628631 defer cancel ()
629632 go server .stop ()
630633 // ct.reader should detect the error and activate ct.Error().
@@ -658,7 +661,7 @@ func performOneRPC(ct ClientTransport) {
658661}
659662
660663func (s ) TestClientMix (t * testing.T ) {
661- s , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
664+ s , ct , cancel := setUp (t , 0 , normal )
662665 defer cancel ()
663666 time .AfterFunc (time .Second , s .stop )
664667 go func (ct ClientTransport ) {
@@ -672,7 +675,7 @@ func (s) TestClientMix(t *testing.T) {
672675}
673676
674677func (s ) TestLargeMessage (t * testing.T ) {
675- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
678+ server , ct , cancel := setUp (t , 0 , normal )
676679 defer cancel ()
677680 callHdr := & CallHdr {
678681 Host : "localhost" ,
@@ -807,7 +810,7 @@ func (s) TestLargeMessageWithDelayRead(t *testing.T) {
807810// proceed until they complete naturally, while not allowing creation of new
808811// streams during this window.
809812func (s ) TestGracefulClose (t * testing.T ) {
810- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , pingpong )
813+ server , ct , cancel := setUp (t , 0 , pingpong )
811814 defer cancel ()
812815 defer func () {
813816 // Stop the server's listener to make the server's goroutines terminate
@@ -873,7 +876,7 @@ func (s) TestGracefulClose(t *testing.T) {
873876}
874877
875878func (s ) TestLargeMessageSuspension (t * testing.T ) {
876- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , suspended )
879+ server , ct , cancel := setUp (t , 0 , suspended )
877880 defer cancel ()
878881 callHdr := & CallHdr {
879882 Host : "localhost" ,
@@ -981,7 +984,7 @@ func (s) TestMaxStreams(t *testing.T) {
981984}
982985
983986func (s ) TestServerContextCanceledOnClosedConnection (t * testing.T ) {
984- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , suspended )
987+ server , ct , cancel := setUp (t , 0 , suspended )
985988 defer cancel ()
986989 callHdr := & CallHdr {
987990 Host : "localhost" ,
@@ -1453,7 +1456,7 @@ func (s) TestClientWithMisbehavedServer(t *testing.T) {
14531456var encodingTestStatus = status .New (codes .Internal , "\n " )
14541457
14551458func (s ) TestEncodingRequiredStatus (t * testing.T ) {
1456- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , encodingRequiredStatus )
1459+ server , ct , cancel := setUp (t , 0 , encodingRequiredStatus )
14571460 defer cancel ()
14581461 callHdr := & CallHdr {
14591462 Host : "localhost" ,
@@ -1481,7 +1484,7 @@ func (s) TestEncodingRequiredStatus(t *testing.T) {
14811484}
14821485
14831486func (s ) TestInvalidHeaderField (t * testing.T ) {
1484- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , invalidHeaderField )
1487+ server , ct , cancel := setUp (t , 0 , invalidHeaderField )
14851488 defer cancel ()
14861489 callHdr := & CallHdr {
14871490 Host : "localhost" ,
@@ -1503,7 +1506,7 @@ func (s) TestInvalidHeaderField(t *testing.T) {
15031506}
15041507
15051508func (s ) TestHeaderChanClosedAfterReceivingAnInvalidHeader (t * testing.T ) {
1506- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , invalidHeaderField )
1509+ server , ct , cancel := setUp (t , 0 , invalidHeaderField )
15071510 defer cancel ()
15081511 defer server .stop ()
15091512 defer ct .Close (fmt .Errorf ("closed manually by test" ))
@@ -2171,7 +2174,7 @@ func (s) TestPingPong1MB(t *testing.T) {
21712174
21722175// This is a stress-test of flow control logic.
21732176func runPingPongTest (t * testing.T , msgSize int ) {
2174- server , client , cancel := setUp (t , 0 , 0 , pingpong )
2177+ server , client , cancel := setUp (t , 0 , pingpong )
21752178 defer cancel ()
21762179 defer server .stop ()
21772180 defer client .Close (fmt .Errorf ("closed manually by test" ))
@@ -2253,7 +2256,7 @@ func (s) TestHeaderTblSize(t *testing.T) {
22532256 }
22542257 }()
22552258
2256- server , ct , cancel := setUp (t , 0 , math . MaxUint32 , normal )
2259+ server , ct , cancel := setUp (t , 0 , normal )
22572260 defer cancel ()
22582261 defer ct .Close (fmt .Errorf ("closed manually by test" ))
22592262 defer server .stop ()
@@ -2612,7 +2615,7 @@ func TestConnectionError_Unwrap(t *testing.T) {
26122615
26132616func (s ) TestPeerSetInServerContext (t * testing.T ) {
26142617 // create client and server transports.
2615- server , client , cancel := setUp (t , 0 , math . MaxUint32 , normal )
2618+ server , client , cancel := setUp (t , 0 , normal )
26162619 defer cancel ()
26172620 defer server .stop ()
26182621 defer client .Close (fmt .Errorf ("closed manually by test" ))
0 commit comments