Revert "Postgres: Switch the datasource plugin from lib/pq to pgx" (#83760)

Revert "Postgres: Switch the datasource plugin from lib/pq to pgx (#81353)"

This reverts commit 8c18d06386c87f2786119ea9a6334e35e4181cbe.
This commit is contained in:
Gábor Farkas
2024-03-01 12:20:47 +01:00
committed by GitHub
parent 0aebb9ee39
commit 142ac22023
17 changed files with 909 additions and 968 deletions

View File

@ -1,12 +1,12 @@
package postgres
import (
"database/sql"
"fmt"
"net"
"testing"
"github.com/jackc/pgx/v5"
pgxstdlib "github.com/jackc/pgx/v5/stdlib"
"github.com/lib/pq"
"github.com/stretchr/testify/require"
"golang.org/x/net/proxy"
)
@ -25,13 +25,13 @@ func TestPostgresProxyDriver(t *testing.T) {
cnnstr := fmt.Sprintf("postgres://auser:password@%s/db?sslmode=disable", dbURL)
t.Run("Connector should use dialer context that routes through the socks proxy to db", func(t *testing.T) {
pgxConf, err := pgx.ParseConfig(cnnstr)
connector, err := pq.NewConnector(cnnstr)
require.NoError(t, err)
dialer := newPostgresProxyDialer(&testDialer{})
pgxConf.DialFunc = newPgxDialFunc(&testDialer{})
db := pgxstdlib.OpenDB(*pgxConf)
connector.Dialer(dialer)
db := sql.OpenDB(connector)
err = db.Ping()
require.Contains(t, err.Error(), "test-dialer is not functional")