On Saturday, December 6, 2014 12:48:37 PM UTC-5, Paul O'Connor wrote:
In my test setup I have a central file (test/config.js) to configure all required test artefacts including:before(function (done) {mongoose.set('debug', true);var opts = { server:{ socketOptions:{ connectTimeoutMS: 3000,socketTimeoutMS: 3000}}};mongoose.connect('mongodb://localhost/test', opts, function (err) { console.log('CONNECTED: ' + mongoose.connection.readyState); done();});});My test files all require test/config.js and I see the default connection get created ok.In a test file I have this function where I setup the model I am testing:before(function (done) {var mongoose = require('mongoose');console.log('State1: ' + mongoose.connection.readyState); var arch = require('../../lib/models').Archive; ....I am seeing different behavior between versions 3.8.5 and 3.8.20, specifically:3.8.5: Works fine3.8.20: Default connection is different between config.js and the test file. In the test file it is empty and readyState = 0. In this case queries on the model cause the system to hang until the socket timeout is reached.
 
댓글 없음:
댓글 쓰기