Attempt to fix timing test flake on older versions of node in CI (#2902)

This commit is contained in:
Brian C 2023-01-23 13:55:38 -08:00 committed by GitHub
parent bb8745b215
commit 47afe5cded
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,7 @@ describe('lifetime timeout', () => {
})
it('connection lifetime should expire and remove the client after the client is done working', (done) => {
const pool = new Pool({ maxLifetimeSeconds: 1 })
pool.query('SELECT pg_sleep(1.01)')
pool.query('SELECT pg_sleep(1.4)')
pool.on('remove', () => {
console.log('expired while busy - on-remove event')
expect(pool.expiredCount).to.equal(0)
@ -33,10 +33,11 @@ describe('lifetime timeout', () => {
'can remove expired clients and recreate them',
co.wrap(function* () {
const pool = new Pool({ maxLifetimeSeconds: 1 })
let query = pool.query('SELECT pg_sleep(1)')
let query = pool.query('SELECT pg_sleep(1.4)')
expect(pool.expiredCount).to.equal(0)
expect(pool.totalCount).to.equal(1)
yield query
yield new Promise((resolve) => setTimeout(resolve, 100))
expect(pool.expiredCount).to.equal(0)
expect(pool.totalCount).to.equal(0)
yield pool.query('SELECT NOW()')