Skip to content

Commit

Permalink
Try to pacify finicky timing test on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jackc committed Apr 22, 2022
1 parent 097b6aa commit 49a8601
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pgxpool/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,14 @@ func TestPoolBackgroundChecksMaxConnIdleTime(t *testing.T) {
c, err := db.Acquire(context.Background())
require.NoError(t, err)
c.Release()
time.Sleep(config.HealthCheckPeriod + 500*time.Millisecond)
time.Sleep(config.HealthCheckPeriod)

for i := 0; i < 1000; i++ {
if db.Stat().TotalConns() == 0 {
break
}
time.Sleep(time.Millisecond)
}

stats := db.Stat()
assert.EqualValues(t, 0, stats.TotalConns())
Expand Down

0 comments on commit 49a8601

Please sign in to comment.