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)
| 151 | // formats, ensuring that the target sent to the dialer does NOT have the |
| 152 | // "unix:" prefix stripped. |
| 153 | func (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]". |
nothing calls this directly
no test coverage detected