mirror of https://github.com/jackc/pgx.git
commit
3dc25d5b9c
|
@ -527,6 +527,7 @@ func TestListenNotifyWhileBusyIsSafe(t *testing.T) {
|
|||
t.Parallel()
|
||||
|
||||
listenerDone := make(chan bool)
|
||||
notifierDone := make(chan bool)
|
||||
go func() {
|
||||
conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE"))
|
||||
defer closeConn(t, conn)
|
||||
|
@ -547,7 +548,9 @@ func TestListenNotifyWhileBusyIsSafe(t *testing.T) {
|
|||
|
||||
for rows.Next() {
|
||||
var n int32
|
||||
rows.Scan(&n)
|
||||
if err := rows.Scan(&n); err != nil {
|
||||
t.Fatalf("Row scan failed: %v", err)
|
||||
}
|
||||
sum += n
|
||||
rowCount++
|
||||
}
|
||||
|
@ -571,6 +574,9 @@ func TestListenNotifyWhileBusyIsSafe(t *testing.T) {
|
|||
go func() {
|
||||
conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE"))
|
||||
defer closeConn(t, conn)
|
||||
defer func() {
|
||||
notifierDone <- true
|
||||
}()
|
||||
|
||||
for i := 0; i < 100000; i++ {
|
||||
mustExec(t, conn, "notify busysafe, 'hello'")
|
||||
|
@ -579,6 +585,7 @@ func TestListenNotifyWhileBusyIsSafe(t *testing.T) {
|
|||
}()
|
||||
|
||||
<-listenerDone
|
||||
<-notifierDone
|
||||
}
|
||||
|
||||
func TestListenNotifySelfNotification(t *testing.T) {
|
||||
|
|
|
@ -196,6 +196,7 @@ func TestConnReleaseChecksMaxConnLifetime(t *testing.T) {
|
|||
config.MaxConnLifetime = 250 * time.Millisecond
|
||||
|
||||
db, err := pgxpool.ConnectConfig(context.Background(), config)
|
||||
require.NoError(t, err)
|
||||
defer db.Close()
|
||||
|
||||
c, err := db.Acquire(context.Background())
|
||||
|
@ -240,6 +241,7 @@ func TestPoolBackgroundChecksMaxConnLifetime(t *testing.T) {
|
|||
config.HealthCheckPeriod = 100 * time.Millisecond
|
||||
|
||||
db, err := pgxpool.ConnectConfig(context.Background(), config)
|
||||
require.NoError(t, err)
|
||||
defer db.Close()
|
||||
|
||||
c, err := db.Acquire(context.Background())
|
||||
|
@ -449,7 +451,8 @@ func TestConnReleaseDestroysClosedConn(t *testing.T) {
|
|||
c, err := pool.Acquire(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
c.Conn().Close(ctx)
|
||||
err = c.Conn().Close(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.EqualValues(t, 1, pool.Stat().TotalConns())
|
||||
|
||||
|
|
|
@ -549,11 +549,13 @@ func TestConnQueryErrorWhileReturningRows(t *testing.T) {
|
|||
|
||||
for rows.Next() {
|
||||
var n int32
|
||||
rows.Scan(&n)
|
||||
if err := rows.Scan(&n); err != nil {
|
||||
t.Fatalf("Row scan failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if err, ok := rows.Err().(*pgconn.PgError); !ok {
|
||||
t.Fatalf("Expected pgx.PgError, got %v", err)
|
||||
if _, ok := rows.Err().(*pgconn.PgError); !ok {
|
||||
t.Fatalf("Expected pgx.PgError, got %v", rows.Err())
|
||||
}
|
||||
|
||||
ensureConnValid(t, conn)
|
||||
|
|
Loading…
Reference in New Issue