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

Method TestMethodConfigDefaultService

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

Source from the content-addressed store, hash-verified

535}
536
537func (s) TestMethodConfigDefaultService(t *testing.T) {
538 addr := "passthrough:///non.existent"
539 cc, err := NewClient(addr, WithTransportCredentials(insecure.NewCredentials()), WithDefaultServiceConfig(`{
540 "methodConfig": [{
541 "name": [
542 {
543 "service": ""
544 }
545 ],
546 "waitForReady": true
547 }]
548}`))
549 if err != nil {
550 t.Fatalf("grpc.NewClient(%s) failed: %v, want: nil", addr, err)
551 }
552 cc.Connect()
553 defer cc.Close()
554
555 m := cc.GetMethodConfig("/foo/Bar")
556 if m.WaitForReady == nil {
557 t.Fatalf("want: method (%q) config to fallback to the default service", "/foo/Bar")
558 }
559}
560
561func (s) TestClientConnCanonicalTarget(t *testing.T) {
562 tests := []struct {

Callers

nothing calls this directly

Calls 8

NewCredentialsFunction · 0.92
WithTransportCredentialsFunction · 0.85
WithDefaultServiceConfigFunction · 0.85
GetMethodConfigMethod · 0.80
NewClientFunction · 0.70
FatalfMethod · 0.65
ConnectMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected