@@ -301,63 +301,49 @@ describe('67. poolCache.js', function() {
301
301
} ) ;
302
302
303
303
it ( '67.1.11 does not throw an error if multiple pools are created without a poolAlias in the same call stack' , function ( done ) {
304
- var pool1Promise ;
305
- var pool2Promise ;
304
+ var pool1 ;
305
+ var pool2 ;
306
306
307
- pool1Promise = oracledb . createPool ( dbConfig ) ;
308
-
309
- pool2Promise = oracledb . createPool ( dbConfig ) ;
307
+ async . parallel (
308
+ [
309
+ function ( callback ) {
310
+ oracledb . createPool ( dbConfig , function ( err , pool ) {
311
+ should . not . exist ( err ) ;
310
312
311
- Promise . all ( [ pool1Promise , pool2Promise ] )
312
- . then ( function ( pools ) {
313
- pools [ 0 ] . close ( function ( err ) {
314
- should . not . exist ( err ) ;
313
+ pool1 = pool ;
315
314
316
- pools [ 1 ] . close ( function ( err ) {
315
+ callback ( ) ;
316
+ } ) ;
317
+ } ,
318
+ function ( callback ) {
319
+ oracledb . createPool ( dbConfig , function ( err , pool ) {
317
320
should . not . exist ( err ) ;
318
321
319
- done ( ) ;
322
+ pool2 = pool ;
323
+
324
+ callback ( ) ;
320
325
} ) ;
321
- } ) ;
322
- } )
323
- . catch ( function ( createPoolErr ) {
324
- // Second pool should have failed, get the default and close it. Need
325
- // to wait briefly as Promise.all catches after first promise rejection
326
- // so default pool may not have been created yet.
327
- setTimeout ( function ( ) {
328
- oracledb . getPool ( ) . close ( function ( err ) {
326
+ }
327
+ ] ,
328
+ function ( createPoolErr ) {
329
+ should . not . exist ( createPoolErr ) ;
330
+
331
+ pool1 . close ( function ( err ) {
332
+ should . not . exist ( err ) ;
333
+
334
+ pool2 . close ( function ( err ) {
329
335
should . not . exist ( err ) ;
330
336
331
337
done ( createPoolErr ) ;
332
338
} ) ;
333
- } , 100 ) ;
334
- } ) ;
339
+ } ) ;
340
+ }
341
+ ) ;
335
342
} ) ;
336
343
} ) ;
337
344
338
345
describe ( '67.2 oracledb.getConnection functional tests' , function ( ) {
339
- it ( '67.2.1 gets a connection from the default pool, returns a promise' , function ( done ) {
340
- oracledb . createPool ( dbConfig , function ( err , pool ) {
341
- should . not . exist ( err ) ;
342
-
343
- // Not specifying a poolAlias, default will be used
344
- oracledb . getConnection ( )
345
- . then ( function ( conn ) {
346
- return conn . close ( ) ;
347
- } )
348
- . then ( function ( ) {
349
- return pool . close ( ) ;
350
- } )
351
- . then ( function ( ) {
352
- done ( ) ;
353
- } )
354
- . catch ( function ( err ) {
355
- done ( err ) ;
356
- } ) ;
357
- } ) ;
358
- } ) ;
359
-
360
- it ( '67.2.2 gets a connection from the default pool, invokes the callback' , function ( done ) {
346
+ it ( '67.2.1 gets a connection from the default pool when no alias is specified' , function ( done ) {
361
347
oracledb . createPool ( dbConfig , function ( err , pool ) {
362
348
should . not . exist ( err ) ;
363
349
@@ -378,31 +364,7 @@ describe('67. poolCache.js', function() {
378
364
} ) ;
379
365
} ) ;
380
366
381
- it ( '67.2.3 gets a connection from the pool with the specified poolAlias, returns a promise' , function ( done ) {
382
- var poolAlias = 'random-pool-alias' ;
383
-
384
- dbConfig . poolAlias = poolAlias ;
385
-
386
- oracledb . createPool ( dbConfig , function ( err , pool ) {
387
- should . not . exist ( err ) ;
388
-
389
- oracledb . getConnection ( poolAlias )
390
- . then ( function ( conn ) {
391
- return conn . close ( ) ;
392
- } )
393
- . then ( function ( ) {
394
- return pool . close ( ) ;
395
- } )
396
- . then ( function ( ) {
397
- done ( ) ;
398
- } )
399
- . catch ( function ( err ) {
400
- done ( err ) ;
401
- } ) ;
402
- } ) ;
403
- } ) ;
404
-
405
- it ( '67.2.4 gets a connection from the pool with the specified poolAlias, invokes the callback' , function ( done ) {
367
+ it ( '67.2.2 gets a connection from the pool with the specified poolAlias' , function ( done ) {
406
368
var poolAlias = 'random-pool-alias' ;
407
369
408
370
dbConfig . poolAlias = poolAlias ;
@@ -426,7 +388,7 @@ describe('67. poolCache.js', function() {
426
388
} ) ;
427
389
} ) ;
428
390
429
- it ( '67.2.5 throws an error if an attempt is made to use the default pool when it does not exist' , function ( done ) {
391
+ it ( '67.2.3 throws an error if an attempt is made to use the default pool when it does not exist' , function ( done ) {
430
392
dbConfig . poolAlias = 'random-pool-alias' ;
431
393
432
394
oracledb . createPool ( dbConfig , function ( err , pool ) {
@@ -447,7 +409,7 @@ describe('67. poolCache.js', function() {
447
409
} ) ;
448
410
} ) ;
449
411
450
- it ( '67.2.6 throws an error if an attempt is made to use a poolAlias for a pool that is not in the cache' , function ( done ) {
412
+ it ( '67.2.4 throws an error if an attempt is made to use a poolAlias for a pool that is not in the cache' , function ( done ) {
451
413
dbConfig . poolAlias = 'random-pool-alias' ;
452
414
453
415
oracledb . createPool ( dbConfig , function ( err , pool ) {
@@ -467,7 +429,7 @@ describe('67. poolCache.js', function() {
467
429
} ) ;
468
430
} ) ;
469
431
470
- it ( '67.2.7 gets a connection from the default pool, even after an aliased pool is created' , function ( done ) {
432
+ it ( '67.2.5 gets a connection from the default pool, even after an aliased pool is created' , function ( done ) {
471
433
oracledb . createPool ( dbConfig , function ( err , pool1 ) {
472
434
should . not . exist ( err ) ;
473
435
@@ -506,7 +468,7 @@ describe('67. poolCache.js', function() {
506
468
} ) ;
507
469
} ) ;
508
470
509
- it ( '67.2.8 uses the right pool, even after multiple pools are created' , function ( done ) {
471
+ it ( '67.2.6 uses the right pool, even after multiple pools are created' , function ( done ) {
510
472
var aliasToUse = 'random-pool-alias-2' ;
511
473
512
474
dbConfig . poolAlias = 'random-pool-alias' ;
0 commit comments