Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

teardown fails to close database connection if callback is not called #229

Closed
sorin7486 opened this Issue · 2 comments

2 participants

@sorin7486

I wrote a test to demonstrate this below. Basically what happens is that Mongolian will keep the script running as long as the DB connection is opened. Because the teardown method doesn't seem to be called if the callback isn't called, the connection is never closed. The result is that the test just hangs.

I'm new to node.js so I'm not sure what is happening here, but maybe there should be a timeout option for the test?

var vows = require('vows');
var Mongolian = require('mongolian');

var db = new Mongolian('mongo://localhost/test');

var topicMethod = function(callback){
    console.log('tested function');
//    callback();
}

vows.describe('Testing using Mongolian').addBatch({
    'when db connection is open': {
        topic: function () {
            topicMethod(this.callback)
        },

        'vows only completes test if callback is called': function (topic) {
            console.log(topic);
        },

        teardown : function(topic){
            db.server.close();
            console.log('taredown');
        }
    }
}).export(module);
@indexzero
Owner

I believe this is a duplicate of #179.

@indexzero indexzero closed this
@indexzero
Owner

Also #223

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.