From 43808f02de014fdf8b1833f9e95a9195ab60b6bb Mon Sep 17 00:00:00 2001 From: alxndrsn <@alxndrsn> Date: Tue, 10 Dec 2019 10:33:20 +0000 Subject: [PATCH 1/2] Fix: clean up getConnection() test properly --- test/integration/connectable/get-connection.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/integration/connectable/get-connection.js b/test/integration/connectable/get-connection.js index 7eb51ad..cf8d641 100644 --- a/test/integration/connectable/get-connection.js +++ b/test/integration/connectable/get-connection.js @@ -24,6 +24,10 @@ describe('Connectable ::', function() { }); }); + after(function(done) { + manager.pool.end(done); + }); + it('should successfully return a PG Client instance', function(done) { Pack.getConnection({ manager: manager @@ -39,8 +43,9 @@ describe('Connectable ::', function() { // Assert that a PG Client is returned assert(report.connection instanceof pg.Client); - // Assert that the connection has a release function - assert(report.connection.release); + // Assert that the connection has a release function, and call it to + // release the connection. + report.connection.release(); return done(); }); From 7042f45831e882b8699452b2983129ec74574ce9 Mon Sep 17 00:00:00 2001 From: Mike McNeil Date: Wed, 18 Mar 2020 16:25:00 -0500 Subject: [PATCH 2/2] shouldn't need to release the connection if destroying the pool in `after` --- test/integration/connectable/get-connection.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/integration/connectable/get-connection.js b/test/integration/connectable/get-connection.js index cf8d641..a0181a0 100644 --- a/test/integration/connectable/get-connection.js +++ b/test/integration/connectable/get-connection.js @@ -42,10 +42,7 @@ describe('Connectable ::', function() { // Assert that a PG Client is returned assert(report.connection instanceof pg.Client); - - // Assert that the connection has a release function, and call it to - // release the connection. - report.connection.release(); + assert('function' === typeof report.connection.release); return done(); });