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 {
120
120
await connection2 . end ( ) ;
121
121
} ) ;
122
122
123
- test ( clientName + ': pool.end() destroys all connections' , async ( t ) => {
123
+ test ( clientName + ': pool.end() immediately resolves if all connections are released ' , async ( t ) => {
124
124
const pool = new Pool ( {
125
125
user : 'postgres' ,
126
126
} ) ;
@@ -135,8 +135,15 @@ for (const {
135
135
await connection1 . release ( ) ;
136
136
await connection2 . release ( ) ;
137
137
138
+ const startTime = Date . now ( ) ;
139
+
138
140
await pool . end ( ) ;
139
141
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
+
140
147
t . is ( pool . totalCount , 0 ) ;
141
148
} ) ;
142
149
You can’t perform that action at this time.
0 commit comments