Skip to content

Commit

Permalink
Fix native tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brianc committed Aug 12, 2024
1 parent 50306bc commit e10bf64
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions packages/pg/test/integration/gh-issues/3174-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,13 @@ const testErrorBuffer = (bufferName, errorBuffer) => {

await client.query('SELECT NOW()')
await delay(50)
assert(cli.native || errorHit)

// further queries on the client should fail since its in an invalid state
await assert.rejects(() => client.query('SELECTR NOW()'), 'Further queries on the client should reject')
// the native client only emits a notice message and keeps on its merry way
if (!cli.native) {
assert(errorHit)
// further queries on the client should fail since its in an invalid state
await assert.rejects(() => client.query('SELECTR NOW()'), 'Further queries on the client should reject')
}

await closeServer()
})
Expand All @@ -120,10 +123,13 @@ const testErrorBuffer = (bufferName, errorBuffer) => {

await client.query('SELECT $1', ['foo'])
await delay(40)
assert(cli.native || errorHit)

// further queries on the client should fail since its in an invalid state
await assert.rejects(() => client.query('SELECTR NOW()'), 'Further queries on the client should reject')
// the native client only emits a notice message and keeps on its merry way
if (!cli.native) {
assert(errorHit)
// further queries on the client should fail since its in an invalid state
await assert.rejects(() => client.query('SELECTR NOW()'), 'Further queries on the client should reject')
}

await client.end()

Expand All @@ -143,10 +149,13 @@ const testErrorBuffer = (bufferName, errorBuffer) => {

await pool.query('SELECT $1', ['foo'])
await delay(100)
assert(cli.native || errorHit)

assert.strictEqual(pool.idleCount, 0, 'Pool should have no idle clients')
assert.strictEqual(pool.totalCount, 0, 'Pool should have no connected clients')
if (!cli.native) {
assert(errorHit)
assert.strictEqual(pool.idleCount, 0, 'Pool should have no idle clients')
assert.strictEqual(pool.totalCount, 0, 'Pool should have no connected clients')
}


Check failure on line 159 in packages/pg/test/integration/gh-issues/3174-tests.js

View workflow job for this annotation

GitHub Actions / lint

Delete `⏎`

Check failure on line 159 in packages/pg/test/integration/gh-issues/3174-tests.js

View workflow job for this annotation

GitHub Actions / lint

Delete `⏎`
await pool.end()
await closeServer()
Expand Down

0 comments on commit e10bf64

Please sign in to comment.