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

Method TestDialContextFailFast

dial_test.go:217–229  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

215func (failFastError) Temporary() bool { return false }
216
217func (s) TestDialContextFailFast(t *testing.T) {
218 ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
219 defer cancel()
220 failErr := failFastError{}
221 dialer := func(string, time.Duration) (net.Conn, error) {
222 return nil, failErr
223 }
224
225 _, err := DialContext(ctx, "Non-Existent.Server:80", WithBlock(), WithTransportCredentials(insecure.NewCredentials()), WithDialer(dialer), FailOnNonTempDialError(true))
226 if terr, ok := err.(transport.ConnectionError); !ok || terr.Origin() != failErr {
227 t.Fatalf("DialContext() = _, %v, want _, %v", err, failErr)
228 }
229}
230
231func (s) TestClientUpdatesParamsAfterGoAway(t *testing.T) {
232 grpctest.ExpectError("Client received GoAway with error code ENHANCE_YOUR_CALM and debug data equal to ASCII \"too_many_pings\"")

Callers

nothing calls this directly

Calls 8

NewCredentialsFunction · 0.92
DialContextFunction · 0.85
WithBlockFunction · 0.85
WithTransportCredentialsFunction · 0.85
WithDialerFunction · 0.85
FailOnNonTempDialErrorFunction · 0.85
OriginMethod · 0.80
FatalfMethod · 0.65

Tested by

no test coverage detected