(t *testing.T)
| 759 | } |
| 760 | |
| 761 | func TestConnectWithAfterNetConnect(t *testing.T) { |
| 762 | t.Parallel() |
| 763 | |
| 764 | ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) |
| 765 | defer cancel() |
| 766 | |
| 767 | config, err := pgconn.ParseConfig(os.Getenv("PGX_TEST_DATABASE")) |
| 768 | require.NoError(t, err) |
| 769 | |
| 770 | var wrappedConn net.Conn |
| 771 | config.AfterNetConnect = func(ctx context.Context, config *pgconn.Config, conn net.Conn) (net.Conn, error) { |
| 772 | wrappedConn = &testConnWrapper{conn: conn} |
| 773 | return wrappedConn, nil |
| 774 | } |
| 775 | conn, err := pgconn.ConnectConfig(ctx, config) |
| 776 | require.NoError(t, err) |
| 777 | |
| 778 | require.Equal(t, wrappedConn, conn.Conn()) |
| 779 | closeConn(t, conn) |
| 780 | } |
| 781 | |
| 782 | func TestConnectWithValidateConnect(t *testing.T) { |
| 783 | t.Parallel() |
nothing calls this directly
no test coverage detected