File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ for (const {
120120 await connection2 . end ( ) ;
121121 } ) ;
122122
123- test ( clientName + ': pool.end() destroys all connections' , async ( t ) => {
123+ test ( clientName + ': pool.end() immediately resolves if all connections are released ' , async ( t ) => {
124124 const pool = new Pool ( {
125125 user : 'postgres' ,
126126 } ) ;
@@ -135,8 +135,15 @@ for (const {
135135 await connection1 . release ( ) ;
136136 await connection2 . release ( ) ;
137137
138+ const startTime = Date . now ( ) ;
139+
138140 await pool . end ( ) ;
139141
142+ const duration = Date . now ( ) - startTime ;
143+
144+ // If duration is longer than a couple milliseconds then something is off.
145+ t . true ( duration < 10 ) ;
146+
140147 t . is ( pool . totalCount , 0 ) ;
141148 } ) ;
142149
You can’t perform that action at this time.
0 commit comments