(t *testing.T)
| 529 | } |
| 530 | |
| 531 | func TestPoolAcquireAllIdle(t *testing.T) { |
| 532 | t.Parallel() |
| 533 | |
| 534 | ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) |
| 535 | defer cancel() |
| 536 | |
| 537 | db, err := pgxpool.New(ctx, os.Getenv("PGX_TEST_DATABASE")) |
| 538 | require.NoError(t, err) |
| 539 | defer db.Close() |
| 540 | |
| 541 | conns := make([]*pgxpool.Conn, 3) |
| 542 | for i := range conns { |
| 543 | conns[i], err = db.Acquire(ctx) |
| 544 | assert.NoError(t, err) |
| 545 | } |
| 546 | |
| 547 | for _, c := range conns { |
| 548 | if c != nil { |
| 549 | c.Release() |
| 550 | } |
| 551 | } |
| 552 | waitForReleaseToComplete() |
| 553 | |
| 554 | conns = db.AcquireAllIdle(ctx) |
| 555 | assert.Len(t, conns, 3) |
| 556 | |
| 557 | for _, c := range conns { |
| 558 | c.Release() |
| 559 | } |
| 560 | } |
| 561 | |
| 562 | func TestPoolReset(t *testing.T) { |
| 563 | t.Parallel() |
nothing calls this directly
no test coverage detected