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

Function setUpWithOptions

internal/transport/transport_test.go:597–611  ·  view source on GitHub ↗
(t *testing.T, port int, sc *ServerConfig, ht hType, copts ConnectOptions)

Source from the content-addressed store, hash-verified

595}
596
597func setUpWithOptions(t *testing.T, port int, sc *ServerConfig, ht hType, copts ConnectOptions) (*server, *http2Client, func()) {
598 server := setUpServerOnly(t, port, sc, ht)
599 addr := resolver.Address{Addr: "localhost:" + server.port}
600 copts.ChannelzParent = channelzSubChannel(t)
601
602 ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
603 t.Cleanup(cancel)
604 connectCtx, cCancel := context.WithTimeout(context.Background(), 2*time.Second)
605 ct, connErr := NewHTTP2Client(connectCtx, ctx, addr, copts, func(GoAwayInfo) {})
606 if connErr != nil {
607 cCancel() // Do not cancel in success path.
608 t.Fatalf("failed to create transport: %v", connErr)
609 }
610 return server, ct.(*http2Client), cCancel
611}
612
613type controllablePingServer struct {
614 pingAck atomic.Bool

Calls 4

setUpServerOnlyFunction · 0.85
channelzSubChannelFunction · 0.85
NewHTTP2ClientFunction · 0.85
FatalfMethod · 0.65

Tested by

no test coverage detected