mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 19:47:54 +00:00
postgres: replace the package lib/pq with pgx (#15343)
* WIP replacing lib/pq * change timezome param to be URI format * add changelog * add changelog for redshift * update changelog * add test for DSN style connection string * more parseurl and quoteidentify to sdk; include copyright and license * call dbutil.ParseURL instead, fix import ordering Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>
This commit is contained in:
@@ -22,7 +22,7 @@ import (
|
||||
"github.com/hashicorp/vault/sdk/helper/pluginutil"
|
||||
"github.com/hashicorp/vault/sdk/logical"
|
||||
"github.com/hashicorp/vault/sdk/queue"
|
||||
"github.com/lib/pq"
|
||||
_ "github.com/jackc/pgx/v4/stdlib"
|
||||
"github.com/stretchr/testify/mock"
|
||||
mongodbatlasapi "go.mongodb.org/atlas/mongodbatlas"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
@@ -419,12 +419,8 @@ func TestBackend_StaticRole_Revoke_user(t *testing.T) {
|
||||
func createTestPGUser(t *testing.T, connURL string, username, password, query string) {
|
||||
t.Helper()
|
||||
log.Printf("[TRACE] Creating test user")
|
||||
conn, err := pq.ParseURL(connURL)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
db, err := sql.Open("postgres", conn)
|
||||
db, err := sql.Open("pgx", connURL)
|
||||
defer db.Close()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -456,7 +452,7 @@ func createTestPGUser(t *testing.T, connURL string, username, password, query st
|
||||
func verifyPgConn(t *testing.T, username, password, connURL string) {
|
||||
t.Helper()
|
||||
cURL := strings.Replace(connURL, "postgres:secret", username+":"+password, 1)
|
||||
db, err := sql.Open("postgres", cURL)
|
||||
db, err := sql.Open("pgx", cURL)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user