Skip to content

Commit 26b28a7

Browse files
committed
added test for ending multiple connection pools at once
1 parent fb46392 commit 26b28a7

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
var helper = require(__dirname + '/test-helper')
2+
var conString1 = helper.connectionString();
3+
var conString2 = helper.connectionString();
4+
var conString3 = helper.connectionString();
5+
var conString4 = helper.connectionString();
6+
7+
var called = false;
8+
test('disconnects', function() {
9+
var sink = new helper.Sink(4, function() {
10+
called = true;
11+
//this should exit the process, killing each connection pool
12+
helper.pg.end();
13+
});
14+
[conString1, conString2, conString3, conString4].forEach(function() {
15+
helper.pg.connect(conString1, function(err, client) {
16+
assert.isNull(err);
17+
client.query("SELECT * FROM NOW()", function(err, result) {
18+
process.nextTick(function() {
19+
assert.equal(called, false, "Should not have disconnected yet")
20+
sink.add();
21+
})
22+
})
23+
})
24+
})
25+
})
26+
27+

0 commit comments

Comments
 (0)