From 49a860125feb91417a9b57455261700ffc55e2cd Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Thu, 21 Apr 2022 19:52:34 -0500 Subject: [PATCH] Try to pacify finicky timing test on CI --- pgxpool/pool_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pgxpool/pool_test.go b/pgxpool/pool_test.go index 9a813ae2a..072ca0530 100644 --- a/pgxpool/pool_test.go +++ b/pgxpool/pool_test.go @@ -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())