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

Method TestGetServiceInfo

server_test.go:87–132  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

85}
86
87func (s) TestGetServiceInfo(t *testing.T) {
88 testSd := ServiceDesc{
89 ServiceName: "grpc.testing.EmptyService",
90 HandlerType: (*emptyServiceServer)(nil),
91 Methods: []MethodDesc{
92 {
93 MethodName: "EmptyCall",
94 Handler: nil,
95 },
96 },
97 Streams: []StreamDesc{
98 {
99 StreamName: "EmptyStream",
100 Handler: nil,
101 ServerStreams: false,
102 ClientStreams: true,
103 },
104 },
105 Metadata: []int{0, 2, 1, 3},
106 }
107
108 server := NewServer()
109 server.RegisterService(&testSd, &testServer{})
110
111 info := server.GetServiceInfo()
112 want := map[string]ServiceInfo{
113 "grpc.testing.EmptyService": {
114 Methods: []MethodInfo{
115 {
116 Name: "EmptyCall",
117 IsClientStream: false,
118 IsServerStream: false,
119 },
120 {
121 Name: "EmptyStream",
122 IsClientStream: true,
123 IsServerStream: false,
124 }},
125 Metadata: []int{0, 2, 1, 3},
126 },
127 }
128
129 if !reflect.DeepEqual(info, want) {
130 t.Errorf("GetServiceInfo() = %+v, want %+v", info, want)
131 }
132}
133
134func (s) TestRetryChainedInterceptor(t *testing.T) {
135 var records []int

Callers

nothing calls this directly

Calls 4

RegisterServiceMethod · 0.95
GetServiceInfoMethod · 0.95
NewServerFunction · 0.70
ErrorfMethod · 0.65

Tested by

no test coverage detected