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

Method TestResolverEmptyUpdateNotPanic

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

Source from the content-addressed store, hash-verified

491}
492
493func (s) TestResolverEmptyUpdateNotPanic(t *testing.T) {
494 r := manual.NewBuilderWithScheme("whatever")
495
496 cc, err := NewClient(r.Scheme()+":///test.server", WithTransportCredentials(insecure.NewCredentials()), WithResolvers(r))
497 if err != nil {
498 t.Fatalf("grpc.NewClient() failed: %v", err)
499 }
500 defer cc.Close()
501 cc.Connect()
502 // This make sure we don't create addrConn with empty address list.
503 r.UpdateState(resolver.State{}) // This should not panic.
504
505 time.Sleep(time.Second) // Sleep to make sure the service config is handled by ClientConn.
506}
507
508func (s) TestDisableServiceConfigOption(t *testing.T) {
509 r := manual.NewBuilderWithScheme("whatever")

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected