(t *testing.T)
| 579 | } |
| 580 | |
| 581 | func TestConnectCustomLookup(t *testing.T) { |
| 582 | t.Parallel() |
| 583 | |
| 584 | ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) |
| 585 | defer cancel() |
| 586 | |
| 587 | connString := os.Getenv("PGX_TEST_TCP_CONN_STRING") |
| 588 | if connString == "" { |
| 589 | t.Skipf("Skipping due to missing environment variable %v", "PGX_TEST_TCP_CONN_STRING") |
| 590 | } |
| 591 | |
| 592 | config, err := pgconn.ParseConfig(connString) |
| 593 | require.NoError(t, err) |
| 594 | |
| 595 | looked := false |
| 596 | config.LookupFunc = func(ctx context.Context, host string) (addrs []string, err error) { |
| 597 | looked = true |
| 598 | return net.LookupHost(host) |
| 599 | } |
| 600 | |
| 601 | conn, err := pgconn.ConnectConfig(ctx, config) |
| 602 | require.NoError(t, err) |
| 603 | require.True(t, looked) |
| 604 | closeConn(t, conn) |
| 605 | } |
| 606 | |
| 607 | func TestConnectCustomLookupWithPort(t *testing.T) { |
| 608 | t.Parallel() |
nothing calls this directly
no test coverage detected