@@ -9,40 +9,40 @@ const poolConfig = common.getConfig();
9
9
10
10
const ACQUITE_TIMEOUT = 500 ;
11
11
const poolWithAcquireTimeout = new mysql . createPool ( {
12
- ...poolConfig ,
13
- acquireTimeout : ACQUITE_TIMEOUT ,
14
- connectionLimit : 2
12
+ ...poolConfig ,
13
+ acquireTimeout : ACQUITE_TIMEOUT ,
14
+ connectionLimit : 2
15
15
} ) ;
16
16
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 ) => {
19
21
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 ( ) ;
26
26
27
- poolWithAcquireTimeout . releaseConnection ( c1 ) ;
27
+ poolWithAcquireTimeout . releaseConnection ( c1 ) ;
28
28
29
- poolWithAcquireTimeout . getConnection ( function ( e4 , c4 ) {
29
+ poolWithAcquireTimeout . getConnection ( ( e4 , c4 ) => {
30
30
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
+ }
46
42
} ) ;
43
+
44
+ poolWithAcquireTimeout . releaseConnection ( c4 ) ;
45
+ } ) ;
47
46
} ) ;
47
+ } ) ;
48
48
} ) ;
0 commit comments