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

Method TestDisableServiceConfigOption

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

Source from the content-addressed store, hash-verified

506}
507
508func (s) TestDisableServiceConfigOption(t *testing.T) {
509 r := manual.NewBuilderWithScheme("whatever")
510 addr := r.Scheme() + ":///non.existent"
511 cc, err := NewClient(addr, WithTransportCredentials(insecure.NewCredentials()), WithResolvers(r), WithDisableServiceConfig())
512 if err != nil {
513 t.Fatalf("grpc.NewClient(%s) failed: %v, want: nil", addr, err)
514 }
515 defer cc.Close()
516 cc.Connect()
517 r.UpdateState(resolver.State{ServiceConfig: r.CC().ParseServiceConfig(`{
518 "methodConfig": [
519 {
520 "name": [
521 {
522 "service": "foo",
523 "method": "Bar"
524 }
525 ],
526 "waitForReady": true
527 }
528 ]
529}`)})
530 time.Sleep(1 * time.Second)
531 m := cc.GetMethodConfig("/foo/Bar")
532 if m.WaitForReady != nil {
533 t.Fatalf("want: method (\"/foo/bar/\") config to be empty, got: %+v", m)
534 }
535}
536
537func (s) TestMethodConfigDefaultService(t *testing.T) {
538 addr := "passthrough:///non.existent"

Callers

nothing calls this directly

Calls 14

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

Tested by

no test coverage detected