Skip to content

Commit 38b69de

Browse files
committed
test: skip broken test due to a bug in pg-pool
1 parent ef0b428 commit 38b69de

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

test/postgres-bridge/bridge.ts

+31-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ for (const {
120120
await connection2.end();
121121
});
122122

123-
test(clientName + ': pool.end() immediately resolves if all connections are released', async (t) => {
123+
test(clientName + ': pool.end() resolves immediately if all connections are released', async (t) => {
124124
const pool = new Pool({
125125
user: 'postgres',
126126
});
@@ -147,6 +147,36 @@ for (const {
147147
t.is(pool.totalCount, 0);
148148
});
149149

150+
// This appears to be a bug in pg-pool
151+
// https://github.com/brianc/node-postgres/issues/2778
152+
// eslint-disable-next-line ava/no-skip-test
153+
test.skip(clientName + ': pool.end() resolves immediately if all connections are ended', async (t) => {
154+
const pool = new Pool({
155+
user: 'postgres',
156+
});
157+
158+
t.is(pool.totalCount, 0);
159+
160+
const connection1 = await pool.connect();
161+
const connection2 = await pool.connect();
162+
163+
t.is(pool.totalCount, 2);
164+
165+
await connection1.end();
166+
await connection2.end();
167+
168+
const startTime = Date.now();
169+
170+
await pool.end();
171+
172+
const duration = Date.now() - startTime;
173+
174+
// If duration is longer than a couple milliseconds then something is off.
175+
t.true(duration < 10);
176+
177+
t.is(pool.totalCount, 0);
178+
});
179+
150180
test(clientName + ': connection.release() releases connection back to the pool', async (t) => {
151181
const pool = new Pool({
152182
user: 'postgres',

0 commit comments

Comments
 (0)