Fix tests

This commit is contained in:
binwiederhier
2026-02-20 08:19:25 -05:00
parent 209d5a4c62
commit 039d555689
9 changed files with 32 additions and 13 deletions

View File

@@ -10,10 +10,10 @@ import (
_ "github.com/jackc/pgx/v5/stdlib" // PostgreSQL driver
)
const defaultMaxOpenConns = 25
const defaultMaxOpenConns = 10
// OpenDB opens a PostgreSQL database connection pool from a DSN string. It supports custom
// query parameters for pool configuration: pool_max_conns (default 25), pool_max_idle_conns,
// query parameters for pool configuration: pool_max_conns (default 10), pool_max_idle_conns,
// pool_conn_max_lifetime, and pool_conn_max_idle_time. These parameters are stripped from
// the DSN before passing it to the driver.
func OpenDB(dsn string) (*sql.DB, error) {
@@ -54,7 +54,7 @@ func OpenDB(dsn string) (*sql.DB, error) {
db.SetConnMaxIdleTime(connMaxIdleTime)
}
if err := db.Ping(); err != nil {
return nil, err
return nil, fmt.Errorf("ping failed: %w", err)
}
return db, nil
}