Skip to content

Commit fd29b62

Browse files
committed
Make domain test more reliable
1 parent bd70e05 commit fd29b62

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/integration/connection/test-domains.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ d1.run(function() {
2727
if (err) throw err;
2828
d7.run(function() {
2929
pool.query('SELECT 2', function(err, _rows, _fields) {
30+
endPool(pool);
3031
if (err) throw err;
3132
throw new Error('inside domain 7');
3233
});
@@ -54,13 +55,13 @@ d1.run(function() {
5455
pool.getConnection(function(err, conn) {
5556
if (err) throw err;
5657
conn.release();
58+
endPool(pool);
5759
throw new Error('inside domain 6');
5860
});
5961
});
6062

6163
connection.end();
6264
setTimeout(function() {
63-
pool.end();
6465
throw new Error('inside domain 1');
6566
}, 100);
6667

@@ -104,3 +105,8 @@ process.on('exit', function() {
104105
assert.equal(''+err6, 'Error: inside domain 6')
105106
assert.equal(''+err7, 'Error: inside domain 7')
106107
});
108+
109+
var poolWait = 2;
110+
function endPool(pool) {
111+
if (!--poolWait) pool.end();
112+
}

0 commit comments

Comments
 (0)