add test for stdlib.OpenDBFromPool

pull/1744/head
Lev Zakharov 2023-08-21 15:24:57 +03:00 committed by Jack Christensen
parent 3e716c4b06
commit 639691c0ab
1 changed files with 12 additions and 0 deletions

View File

@ -18,6 +18,7 @@ import (
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgconn"
"github.com/jackc/pgx/v5/pgtype"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/jackc/pgx/v5/stdlib"
"github.com/jackc/pgx/v5/tracelog"
"github.com/stretchr/testify/assert"
@ -166,6 +167,17 @@ func TestSQLOpen(t *testing.T) {
}
}
func TestSQLOpenFromPool(t *testing.T) {
pool, err := pgxpool.New(context.Background(), os.Getenv("PGX_TEST_DATABASE"))
require.NoError(t, err)
t.Cleanup(pool.Close)
db := stdlib.OpenDBFromPool(pool)
ensureDBValid(t, db)
db.Close()
}
func TestNormalLifeCycle(t *testing.T) {
db := openDB(t)
defer closeDB(t, db)