Skip to content

Commit 20e7fa2

Browse files
authored
chore: check if is the same pid
1 parent 754b85d commit 20e7fa2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/pg-pool/test/prioritizing-prepared-client.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@ describe('prioritizing prepared client', () => {
1515

1616
let res
1717

18-
res = yield pool.query({ text: 'SELECT $1::text as name', values: ['hi'], name: 'foo' })
18+
res = yield pool.query({ text: 'SELECT $1::text as name, pg_backend_pid() as pid', values: ['hi'], name: 'foo' })
1919
expect(res.rows[0].name).to.equal('hi')
2020
expect(pool._idle.length).to.equal(1)
21+
const firstPid = res.rows[0].pid
2122

22-
res = yield pool.query({ text: 'SELECT $1::text as name', values: ['ho'], name: 'foo' })
23+
res = yield pool.query({ text: 'SELECT $1::text as name, pg_backend_pid() as pid', values: ['ho'], name: 'foo' })
2324
expect(res.rows[0].name).to.equal('ho')
2425
expect(pool._idle.length).to.equal(1)
26+
const secondPid = res.rows[0].pid
27+
28+
expect(firstPid).to.equal(secondPid)
2529

2630
pool.end()
2731
})

0 commit comments

Comments
 (0)