@@ -9,40 +9,40 @@ const poolConfig = common.getConfig();
99
1010const ACQUITE_TIMEOUT = 500 ;
1111const poolWithAcquireTimeout = new mysql . createPool ( {
12- ...poolConfig ,
13- acquireTimeout : ACQUITE_TIMEOUT ,
14- connectionLimit : 2
12+ ...poolConfig ,
13+ acquireTimeout : ACQUITE_TIMEOUT ,
14+ connectionLimit : 2
1515} ) ;
1616
17- poolWithAcquireTimeout . getConnection ( function ( err , c1 ) {
18- assert . equal ( ! ! c1 , true ) ;
17+ poolWithAcquireTimeout . getConnection ( ( err , c1 ) => {
18+ assert . equal ( ! ! c1 , true ) ;
19+ assert . ifError ( err ) ;
20+ poolWithAcquireTimeout . getConnection ( ( err , c2 ) => {
1921 assert . ifError ( err ) ;
20- poolWithAcquireTimeout . getConnection ( function ( err , c2 ) {
21- assert . ifError ( err ) ;
22- assert . equal ( ! ! c2 , true ) ;
23- const C3_STARTED_AT = Date . now ( ) ;
24- poolWithAcquireTimeout . getConnection ( function ( e3 , c3 ) {
25- const C3_DONE_AT = Date . now ( ) ;
22+ assert . equal ( ! ! c2 , true ) ;
23+ const C3_STARTED_AT = Date . now ( ) ;
24+ poolWithAcquireTimeout . getConnection ( ( e3 , c3 ) => {
25+ const C3_DONE_AT = Date . now ( ) ;
2626
27- poolWithAcquireTimeout . releaseConnection ( c1 ) ;
27+ poolWithAcquireTimeout . releaseConnection ( c1 ) ;
2828
29- poolWithAcquireTimeout . getConnection ( function ( e4 , c4 ) {
29+ poolWithAcquireTimeout . getConnection ( ( e4 , c4 ) => {
3030
31- test ( 'Pool With Acquire Timeout' , {
32- 'timeout of pool is full' : ( ) => {
33- assert . equal ( e3 !== null , true ) ;
34- assert . equal ( ! c3 , true ) ;
35- assert . equal ( C3_DONE_AT - C3_STARTED_AT >= ACQUITE_TIMEOUT , true ) ;
36- assert . equal ( C3_DONE_AT - C3_STARTED_AT < ACQUITE_TIMEOUT * 2 , true ) ;
37- } ,
38- 'ok if pool is not full' : ( ) => {
39- assert . equal ( e4 === null , true ) ;
40- assert . equal ( ! ! c4 , true ) ;
41- }
42- } ) ;
43-
44- poolWithAcquireTimeout . releaseConnection ( c4 ) ;
45- } ) ;
31+ test ( 'Pool With Acquire Timeout' , {
32+ 'timeout of pool is full' : ( ) => {
33+ assert . equal ( e3 !== null , true ) ;
34+ assert . equal ( ! c3 , true ) ;
35+ assert . equal ( C3_DONE_AT - C3_STARTED_AT >= ACQUITE_TIMEOUT , true ) ;
36+ assert . equal ( C3_DONE_AT - C3_STARTED_AT < ACQUITE_TIMEOUT * 2 , true ) ;
37+ } ,
38+ 'ok if pool is not full' : ( ) => {
39+ assert . equal ( e4 === null , true ) ;
40+ assert . equal ( ! ! c4 , true ) ;
41+ }
4642 } ) ;
43+
44+ poolWithAcquireTimeout . releaseConnection ( c4 ) ;
45+ } ) ;
4746 } ) ;
47+ } ) ;
4848} ) ;
0 commit comments