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

Method clientConn

stats/stats_test.go:259–285  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

257}
258
259func (te *test) clientConn(ctx context.Context) *grpc.ClientConn {
260 if te.cc != nil {
261 return te.cc
262 }
263 opts := []grpc.DialOption{
264 grpc.WithTransportCredentials(insecure.NewCredentials()),
265 grpc.WithUserAgent("test/0.0.1"),
266 }
267 if te.compress == "gzip" {
268 opts = append(opts,
269 grpc.WithCompressor(grpc.NewGZIPCompressor()),
270 grpc.WithDecompressor(grpc.NewGZIPDecompressor()),
271 )
272 }
273 for _, sh := range te.clientStatsHandlers {
274 opts = append(opts, grpc.WithStatsHandler(sh))
275 }
276
277 var err error
278 te.cc, err = grpc.NewClient(te.srvAddr, opts...)
279 if err != nil {
280 te.t.Fatalf("grpc.NewClient(%q) failed: %v", te.srvAddr, err)
281 }
282 te.cc.Connect()
283 testutils.AwaitState(ctx, te.t, te.cc, connectivity.Ready)
284 return te.cc
285}
286
287type rpcType int
288

Callers 4

doUnaryCallMethod · 0.95
doClientStreamCallMethod · 0.95
doServerStreamCallMethod · 0.95

Calls 12

WithTransportCredentialsFunction · 0.92
NewCredentialsFunction · 0.92
WithUserAgentFunction · 0.92
WithCompressorFunction · 0.92
NewGZIPCompressorFunction · 0.92
WithDecompressorFunction · 0.92
NewGZIPDecompressorFunction · 0.92
WithStatsHandlerFunction · 0.92
NewClientFunction · 0.92
AwaitStateFunction · 0.92
FatalfMethod · 0.65
ConnectMethod · 0.65

Tested by

no test coverage detected