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

Method startServer

stats/stats_test.go:241–257  ·  view source on GitHub ↗

startServer starts a gRPC server listening. Callers should defer a call to te.tearDown to clean up.

(ss *stubserver.StubServer)

Source from the content-addressed store, hash-verified

239// startServer starts a gRPC server listening. Callers should defer a
240// call to te.tearDown to clean up.
241func (te *test) startServer(ss *stubserver.StubServer) {
242 var opts []grpc.ServerOption
243 if te.compress == "gzip" {
244 opts = append(opts,
245 grpc.RPCCompressor(grpc.NewGZIPCompressor()),
246 grpc.RPCDecompressor(grpc.NewGZIPDecompressor()),
247 )
248 }
249 for _, sh := range te.serverStatsHandlers {
250 opts = append(opts, grpc.StatsHandler(sh))
251 }
252 if err := ss.StartServer(opts...); err != nil {
253 te.t.Fatalf("StubServer.StartServer() failed: %v", err)
254 }
255 te.srv = ss.S
256 te.srvAddr = ss.Address
257}
258
259func (te *test) clientConn(ctx context.Context) *grpc.ClientConn {
260 if te.cc != nil {

Callers 4

testServerStatsFunction · 0.45
testClientStatsFunction · 0.45

Calls 7

RPCCompressorFunction · 0.92
NewGZIPCompressorFunction · 0.92
RPCDecompressorFunction · 0.92
NewGZIPDecompressorFunction · 0.92
StatsHandlerFunction · 0.92
StartServerMethod · 0.80
FatalfMethod · 0.65

Tested by

no test coverage detected