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

Method TestUnixCustomDialer

test/authority_test.go:153–166  ·  view source on GitHub ↗

TestUnixCustomDialer does end to end tests with various supported unix target formats, ensuring that the target sent to the dialer does NOT have the "unix:" prefix stripped.

(t *testing.T)

Source from the content-addressed store, hash-verified

151// formats, ensuring that the target sent to the dialer does NOT have the
152// "unix:" prefix stripped.
153func (s) TestUnixCustomDialer(t *testing.T) {
154 for _, test := range authorityTests {
155 t.Run(test.name+"WithDialer", func(t *testing.T) {
156 dialer := func(ctx context.Context, address string) (net.Conn, error) {
157 if address != test.dialTargetWant {
158 return nil, fmt.Errorf("expected target %v in custom dialer, instead got %v", test.dialTargetWant, address)
159 }
160 address = address[len("unix:"):]
161 return (&net.Dialer{}).DialContext(ctx, "unix", address)
162 }
163 runUnixTest(t, test.address, test.target, test.authority, dialer)
164 })
165 }
166}
167
168// TestColonPortAuthority does an end to end test with the target for grpc.NewClient
169// being ":[port]". Ensures authority is "localhost:[port]".

Callers

nothing calls this directly

Calls 3

runUnixTestFunction · 0.85
ErrorfMethod · 0.65
DialContextMethod · 0.45

Tested by

no test coverage detected