Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
testing
  • Loading branch information
niclaflamme committed Aug 8, 2025
commit 956a0cb0f5cbe03151e65de079a8e89f9b4c1556
25 changes: 21 additions & 4 deletions integration/go/go_pgx/load_balancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,27 @@ outer:
}

func prewarm(t *testing.T, pool *pgxpool.Pool) {
ctx := context.Background()
for range 25 {
for _, q := range []string{"BEGIN", "SELECT 1", "COMMIT", "SELECT 1"} {
_, err := pool.Exec(context.Background(), q)
assert.NoError(t, err)
}
// pin to one connection via a real Tx
tx, err := pool.Begin(ctx)
assert.NoError(t, err)
_, err = tx.Exec(ctx, "SELECT 1")
assert.NoError(t, err)
err = tx.Commit(ctx)
assert.NoError(t, err)

// simple query to warm another round
_, err = pool.Exec(ctx, "SELECT 1")
assert.NoError(t, err)
}
}

// func prewarm(t *testing.T, pool *pgxpool.Pool) {
// for range 25 {
// for _, q := range []string{"BEGIN", "SELECT 1", "COMMIT", "SELECT 1"} {
// _, err := pool.Exec(context.Background(), q)
// assert.NoError(t, err)
// }
// }
// }
Loading