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

@ -14,7 +14,6 @@ import (
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
"github.com/grafana/grafana-plugin-sdk-go/experimental"
"github.com/jackc/pgx/v5"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/tsdb/sqleng"
@ -52,7 +51,7 @@ func TestIntegrationPostgresSnapshots(t *testing.T) {
t.Skip()
}
getCnn := func() (*pgx.ConnConfig, error) {
getCnnStr := func() string {
host := os.Getenv("POSTGRES_HOST")
if host == "" {
host = "localhost"
@ -62,10 +61,8 @@ func TestIntegrationPostgresSnapshots(t *testing.T) {
port = "5432"
}
cnnString := fmt.Sprintf("user=grafanatest password=grafanatest host=%s port=%s dbname=grafanadstest sslmode=disable",
return fmt.Sprintf("user=grafanatest password=grafanatest host=%s port=%s dbname=grafanadstest sslmode=disable",
host, port)
return pgx.ParseConfig(cnnString)
}
sqlQueryCommentRe := regexp.MustCompile(`^-- (.+)\n`)
@ -160,10 +157,9 @@ func TestIntegrationPostgresSnapshots(t *testing.T) {
logger := log.New()
cnn, err := getCnn()
require.NoError(t, err)
cnnstr := getCnnStr()
db, handler, err := newPostgres(context.Background(), "error", 10000, dsInfo, cnn, logger, backend.DataSourceInstanceSettings{})
db, handler, err := newPostgres(context.Background(), "error", 10000, dsInfo, cnnstr, logger, backend.DataSourceInstanceSettings{})
t.Cleanup((func() {
_, err := db.Exec("DROP TABLE tbl")