[v11.0.x] Revert "Postgres: Switch the datasource plugin from lib/pq to pgx (#8… (#85517)
Revert "Postgres: Switch the datasource plugin from lib/pq to pgx (#8… (#85509) Revert "Postgres: Switch the datasource plugin from lib/pq to pgx (#83768)" This reverts commitecd6de826a. (cherry picked from commit8159e1db3a) Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
This commit is contained in:
co-authored by
Gábor Farkas
parent
0c10923304
commit
ae73f31cf1
@@ -3,6 +3,7 @@ package postgres
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
@@ -48,6 +49,20 @@ func TestIntegrationPostgresSnapshots(t *testing.T) {
|
||||
t.Skip()
|
||||
}
|
||||
|
||||
getCnnStr := func() string {
|
||||
host := os.Getenv("POSTGRES_HOST")
|
||||
if host == "" {
|
||||
host = "localhost"
|
||||
}
|
||||
port := os.Getenv("POSTGRES_PORT")
|
||||
if port == "" {
|
||||
port = "5432"
|
||||
}
|
||||
|
||||
return fmt.Sprintf("user=grafanatest password=grafanatest host=%s port=%s dbname=grafanadstest sslmode=disable",
|
||||
host, port)
|
||||
}
|
||||
|
||||
sqlQueryCommentRe := regexp.MustCompile(`^-- (.+)\n`)
|
||||
|
||||
readSqlFile := func(path string) (string, string) {
|
||||
@@ -134,34 +149,18 @@ func TestIntegrationPostgresSnapshots(t *testing.T) {
|
||||
ConnMaxLifetime: 14400,
|
||||
Timescaledb: false,
|
||||
ConfigurationMethod: "file-path",
|
||||
Mode: "disable",
|
||||
}
|
||||
|
||||
host := os.Getenv("POSTGRES_HOST")
|
||||
if host == "" {
|
||||
host = "localhost"
|
||||
}
|
||||
port := os.Getenv("POSTGRES_PORT")
|
||||
if port == "" {
|
||||
port = "5432"
|
||||
}
|
||||
|
||||
dsInfo := sqleng.DataSourceInfo{
|
||||
JsonData: jsonData,
|
||||
DecryptedSecureJSONData: map[string]string{
|
||||
"password": "grafanatest",
|
||||
},
|
||||
URL: host + ":" + port,
|
||||
Database: "grafanadstest",
|
||||
User: "grafanatest",
|
||||
JsonData: jsonData,
|
||||
DecryptedSecureJSONData: map[string]string{},
|
||||
}
|
||||
|
||||
logger := log.New()
|
||||
|
||||
settings := backend.DataSourceInstanceSettings{}
|
||||
proxyClient, err := settings.ProxyClient(context.Background())
|
||||
require.NoError(t, err)
|
||||
db, handler, err := newPostgres("error", 10000, dsInfo, logger, proxyClient)
|
||||
cnnstr := getCnnStr()
|
||||
|
||||
db, handler, err := newPostgres(context.Background(), "error", 10000, dsInfo, cnnstr, logger, backend.DataSourceInstanceSettings{})
|
||||
|
||||
t.Cleanup((func() {
|
||||
_, err := db.Exec("DROP TABLE tbl")
|
||||
|
||||
Reference in New Issue
Block a user