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

Method TestResolverServiceConfigWhileClosingNotPanic

clientconn_test.go:479–491  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

477}
478
479func (s) TestResolverServiceConfigWhileClosingNotPanic(t *testing.T) {
480 for i := 0; i < 10; i++ { // Run this multiple times to make sure it doesn't panic.
481 r := manual.NewBuilderWithScheme(fmt.Sprintf("whatever-%d", i))
482 cc, err := NewClient(r.Scheme()+":///test.server", WithTransportCredentials(insecure.NewCredentials()), WithResolvers(r))
483 if err != nil {
484 t.Fatalf("grpc.NewClient() failed: %v", err)
485 }
486 cc.Connect()
487 // Send a new service config while closing the ClientConn.
488 go cc.Close()
489 go r.UpdateState(resolver.State{ServiceConfig: r.CC().ParseServiceConfig(rrServiceConfig)}) // This should not panic.
490 }
491}
492
493func (s) TestResolverEmptyUpdateNotPanic(t *testing.T) {
494 r := manual.NewBuilderWithScheme("whatever")

Callers

nothing calls this directly

Calls 12

NewBuilderWithSchemeFunction · 0.92
NewCredentialsFunction · 0.92
WithTransportCredentialsFunction · 0.85
WithResolversFunction · 0.85
CCMethod · 0.80
NewClientFunction · 0.70
SchemeMethod · 0.65
FatalfMethod · 0.65
ConnectMethod · 0.65
CloseMethod · 0.65
UpdateStateMethod · 0.65
ParseServiceConfigMethod · 0.65

Tested by

no test coverage detected