(t *testing.T)
| 236 | } |
| 237 | |
| 238 | func (s) TestParsedTarget_WithCustomDialer(t *testing.T) { |
| 239 | resetInitialResolverState() |
| 240 | defScheme := resolver.GetDefaultScheme() |
| 241 | tests := []struct { |
| 242 | target string |
| 243 | wantParsed resolver.Target |
| 244 | wantDialerAddress string |
| 245 | }{ |
| 246 | // unix:[local_path], unix:[/absolute], and unix://[/absolute] have |
| 247 | // different behaviors with a custom dialer. |
| 248 | { |
| 249 | target: "unix:a/b/c", |
| 250 | wantParsed: resolver.Target{URL: *testutils.MustParseURL("unix:a/b/c")}, |
| 251 | wantDialerAddress: "unix:a/b/c", |
| 252 | }, |
| 253 | { |
| 254 | target: "unix:/a/b/c", |
| 255 | wantParsed: resolver.Target{URL: *testutils.MustParseURL("unix:/a/b/c")}, |
| 256 | wantDialerAddress: "unix:///a/b/c", |
| 257 | }, |
| 258 | { |
| 259 | target: "unix:///a/b/c", |
| 260 | wantParsed: resolver.Target{URL: *testutils.MustParseURL("unix:///a/b/c")}, |
| 261 | wantDialerAddress: "unix:///a/b/c", |
| 262 | }, |
| 263 | { |
| 264 | target: "dns:///127.0.0.1:50051", |
| 265 | wantParsed: resolver.Target{URL: *testutils.MustParseURL("dns:///127.0.0.1:50051")}, |
| 266 | wantDialerAddress: "127.0.0.1:50051", |
| 267 | }, |
| 268 | { |
| 269 | target: ":///127.0.0.1:50051", |
| 270 | wantParsed: resolver.Target{URL: *testutils.MustParseURL(fmt.Sprintf("%s:///%s", defScheme, ":///127.0.0.1:50051"))}, |
| 271 | wantDialerAddress: ":///127.0.0.1:50051", |
| 272 | }, |
| 273 | { |
| 274 | target: "dns://authority/127.0.0.1:50051", |
| 275 | wantParsed: resolver.Target{URL: *testutils.MustParseURL("dns://authority/127.0.0.1:50051")}, |
| 276 | wantDialerAddress: "127.0.0.1:50051", |
| 277 | }, |
| 278 | { |
| 279 | target: "://authority/127.0.0.1:50051", |
| 280 | wantParsed: resolver.Target{URL: *testutils.MustParseURL(fmt.Sprintf("%s:///%s", defScheme, "://authority/127.0.0.1:50051"))}, |
| 281 | wantDialerAddress: "://authority/127.0.0.1:50051", |
| 282 | }, |
| 283 | { |
| 284 | target: "/unix/socket/address", |
| 285 | wantParsed: resolver.Target{URL: *testutils.MustParseURL(fmt.Sprintf("%s:///%s", defScheme, "/unix/socket/address"))}, |
| 286 | wantDialerAddress: "/unix/socket/address", |
| 287 | }, |
| 288 | { |
| 289 | target: "", |
| 290 | wantParsed: resolver.Target{URL: *testutils.MustParseURL(fmt.Sprintf("%s:///%s", defScheme, ""))}, |
| 291 | wantDialerAddress: "", |
| 292 | }, |
| 293 | { |
| 294 | target: "passthrough://a.server.com/google.com", |
| 295 | wantParsed: resolver.Target{URL: *testutils.MustParseURL("passthrough://a.server.com/google.com")}, |
nothing calls this directly
no test coverage detected