Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Mar 13, 2015
1 parent 4cfda7d commit b135acb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/functional/connection_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,10 @@ exports['Should correctly reconnect and finish query operation'] = {
db.collection('test_reconnect').insert({a:1}, function(err, doc) {
test.equal(null, err);
// Signal db reconnect
var dbReconnect = false;
var dbReconnect = 0;

db.once('reconnect', function() {
dbReconnect = true;
db.on('reconnect', function() {
++dbReconnect;
});

db.serverConfig.once('reconnect', function() {
Expand All @@ -342,6 +342,7 @@ exports['Should correctly reconnect and finish query operation'] = {
db.collection('test_reconnect').findOne(function(err, doc) {
test.equal(null, err);
test.equal(1, doc.a);
test.equal(1, dbReconnect);

// Attempt disconnect again
db.serverConfig.connections()[0].destroy();
Expand All @@ -350,7 +351,7 @@ exports['Should correctly reconnect and finish query operation'] = {
db.collection('test_reconnect').findOne(function(err, doc) {
test.equal(null, err);
test.equal(1, doc.a);
test.equal(true, dbReconnect);
test.equal(2, dbReconnect);

db.close();
test.done();
Expand Down

0 comments on commit b135acb

Please sign in to comment.