MCPcopy
hub / github.com/grpc/grpc-go / testExceedMaxStreamsLimit

Function testExceedMaxStreamsLimit

test/end2end_test.go:4237–4269  ·  view source on GitHub ↗
(t *testing.T, e env)

Source from the content-addressed store, hash-verified

4235}
4236
4237func testExceedMaxStreamsLimit(t *testing.T, e env) {
4238 te := newTest(t, e)
4239 te.declareLogNoise(
4240 "http2Client.notifyError got notified that the client transport was broken",
4241 "Conn.resetTransport failed to create client transport",
4242 "grpc: the connection is closing",
4243 )
4244 te.maxStream = 1 // Only allows 1 live stream per server transport.
4245 te.startServer(&testServer{security: e.security})
4246 defer te.tearDown()
4247
4248 cc := te.clientConn()
4249 tc := testgrpc.NewTestServiceClient(cc)
4250
4251 _, err := tc.StreamingInputCall(te.ctx)
4252 if err != nil {
4253 t.Fatalf("%v.StreamingInputCall(_) = _, %v, want _, <nil>", tc, err)
4254 }
4255 // Loop until receiving the new max stream setting from the server.
4256 for {
4257 ctx, cancel := context.WithTimeout(context.Background(), defaultTestShortTimeout)
4258 defer cancel()
4259 _, err := tc.StreamingInputCall(ctx)
4260 if err == nil {
4261 time.Sleep(50 * time.Millisecond)
4262 continue
4263 }
4264 if status.Code(err) == codes.DeadlineExceeded {
4265 break
4266 }
4267 t.Fatalf("%v.StreamingInputCall(_) = _, %v, want _, %s", tc, err, codes.DeadlineExceeded)
4268 }
4269}
4270
4271func (s) TestStreamsQuotaRecovery(t *testing.T) {
4272 for _, e := range listTestEnv() {

Callers 1

Calls 8

StreamingInputCallMethod · 0.95
declareLogNoiseMethod · 0.80
CodeMethod · 0.80
newTestFunction · 0.70
FatalfMethod · 0.65
startServerMethod · 0.45
tearDownMethod · 0.45
clientConnMethod · 0.45

Tested by

no test coverage detected