@@ -337,6 +337,9 @@ func (s *server) start(t *testing.T, port int, serverConfig *ServerConfig, ht hT
337337return
338338}
339339rawConn := conn
340+ if serverConfig .MaxStreams == 0 {
341+ serverConfig .MaxStreams = math .MaxUint32
342+ }
340343transport , err := NewServerTransport (conn , serverConfig )
341344if err != nil {
342345return
@@ -443,8 +446,8 @@ func setUpServerOnly(t *testing.T, port int, sc *ServerConfig, ht hType) *server
443446return 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 )
543546defer cancel ()
544547defer server .stop ()
545548callHdr := & 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 )
588591defer cancel ()
589592callHdr := & CallHdr {
590593Host : "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 )
628631defer cancel ()
629632go 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 )
662665defer cancel ()
663666time .AfterFunc (time .Second , s .stop )
664667go 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 )
676679defer cancel ()
677680callHdr := & CallHdr {
678681Host : "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 )
811814defer cancel ()
812815defer 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 )
877880defer cancel ()
878881callHdr := & CallHdr {
879882Host : "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 )
985988defer cancel ()
986989callHdr := & CallHdr {
987990Host : "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 )
14571460defer cancel ()
14581461callHdr := & CallHdr {
14591462Host : "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 )
14851488defer cancel ()
14861489callHdr := & CallHdr {
14871490Host : "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 )
15071510defer cancel ()
15081511defer server .stop ()
15091512defer 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 )
21752178defer cancel ()
21762179defer server .stop ()
21772180defer 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 )
22572260defer cancel ()
22582261defer ct .Close (fmt .Errorf ("closed manually by test" ))
22592262defer 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 )
26162619defer cancel ()
26172620defer server .stop ()
26182621defer client .Close (fmt .Errorf ("closed manually by test" ))
0 commit comments