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

Method TestDial_ResolverBuilder_Error

dial_test.go:335–348  ·  view source on GitHub ↗

Tests that Dial returns an error if the resolver builder returns an error from its Build method.

(t *testing.T)

Source from the content-addressed store, hash-verified

333// Tests that Dial returns an error if the resolver builder returns an error
334// from its Build method.
335func (s) TestDial_ResolverBuilder_Error(t *testing.T) {
336 resolverErr := fmt.Errorf("resolver builder error")
337 dopts := []DialOption{
338 WithTransportCredentials(insecure.NewCredentials()),
339 WithResolvers(&errResolverBuilder{err: resolverErr}),
340 }
341 _, err := Dial(errResolverBuilderScheme+":///test.server", dopts...)
342 if err == nil {
343 t.Fatalf("Dial() succeeded when it should have failed")
344 }
345 if !strings.Contains(err.Error(), resolverErr.Error()) {
346 t.Fatalf("Dial() failed with error %v, want %v", err, resolverErr)
347 }
348}

Callers

nothing calls this directly

Calls 7

NewCredentialsFunction · 0.92
WithTransportCredentialsFunction · 0.85
WithResolversFunction · 0.85
DialFunction · 0.70
ErrorfMethod · 0.65
FatalfMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected