mirror of https://github.com/jackc/pgx.git
add test for stdlib.OpenDBFromPool
parent
3e716c4b06
commit
639691c0ab
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue