File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,18 @@ describe('2. pool.js', function() {
115
115
} ) ; // 2.2
116
116
117
117
describe ( '2.3 poolMax' , function ( ) {
118
+ let pool ;
119
+ let isPoolClosed = true ;
120
+
121
+ afterEach ( async function ( ) {
122
+ // Ensure that pool is closed irrespective of any test failures.
123
+ // Not closing a pool impacts the poolCache, which may be used by later
124
+ // tests and lead to false test failures.
125
+ if ( ! isPoolClosed && pool ) {
126
+ await pool . close ( 0 ) ;
127
+ isPoolClosed = true ;
128
+ }
129
+ } ) ;
118
130
119
131
it ( '2.3.1 poolMax cannot be a negative value' , async function ( ) {
120
132
const config = { ...dbConfig ,
@@ -167,7 +179,8 @@ describe('2. pool.js', function() {
167
179
poolTimeout : 1 ,
168
180
queueTimeout : 1
169
181
} ;
170
- const pool = await oracledb . createPool ( config ) ;
182
+ pool = await oracledb . createPool ( config ) ;
183
+ isPoolClosed = false ;
171
184
conns . push ( await pool . getConnection ( ) ) ;
172
185
conns . push ( await pool . getConnection ( ) ) ;
173
186
await assert . rejects (
@@ -187,6 +200,7 @@ describe('2. pool.js', function() {
187
200
} , 2000 ) ;
188
201
} ) ;
189
202
await pool . close ( 0 ) ;
203
+ isPoolClosed = true ;
190
204
} ) ;
191
205
192
206
} ) ; // 2.3
You can’t perform that action at this time.
0 commit comments