2
0

Replace connection pool

This commit is contained in:
Jack Christensen
2019-04-10 11:09:42 -05:00
parent ec10fdde8b
commit 77a2da2b46
9 changed files with 42 additions and 1602 deletions
+23
View File
@@ -209,3 +209,26 @@ func TestConnReleaseDestroysClosedConn(t *testing.T) {
assert.Equal(t, 0, pool.Stat().TotalConns())
}
func TestConnPoolQueryConcurrentLoad(t *testing.T) {
pool, err := pool.Connect(context.Background(), os.Getenv("PGX_TEST_DATABASE"))
require.NoError(t, err)
defer pool.Close()
n := 100
done := make(chan bool)
for i := 0; i < n; i++ {
go func() {
defer func() { done <- true }()
testQuery(t, pool)
testQueryEx(t, pool)
testQueryRow(t, pool)
testQueryRowEx(t, pool)
}()
}
for i := 0; i < n; i++ {
<-done
}
}