Skip to content

Commit 9083069

Browse files
committed
1 parent ce04eba commit 9083069

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/functional/connection_tests.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,18 +331,24 @@ exports['Should correctly reconnect and finish query operation'] = {
331331
test.equal(null, err);
332332
// Signal db reconnect
333333
var dbReconnect = 0;
334+
var dbClose = 0;
334335

335336
db.on('reconnect', function() {
336337
++dbReconnect;
337338
});
338339

340+
db.on('close', function() {
341+
++dbClose;
342+
});
343+
339344
db.serverConfig.once('reconnect', function() {
340345

341346
// Await reconnect and re-authentication
342347
db.collection('test_reconnect').findOne(function(err, doc) {
343348
test.equal(null, err);
344349
test.equal(1, doc.a);
345350
test.equal(1, dbReconnect);
351+
test.equal(1, dbClose);
346352

347353
// Attempt disconnect again
348354
db.serverConfig.connections()[0].destroy();
@@ -352,6 +358,7 @@ exports['Should correctly reconnect and finish query operation'] = {
352358
test.equal(null, err);
353359
test.equal(1, doc.a);
354360
test.equal(2, dbReconnect);
361+
test.equal(2, dbClose);
355362

356363
db.close();
357364
test.done();
@@ -364,4 +371,4 @@ exports['Should correctly reconnect and finish query operation'] = {
364371
});
365372
});
366373
}
367-
}
374+
}

0 commit comments

Comments
 (0)