Closed ayuwono closed 9 years ago
The time a request requires is expected to vary depending on server, client, and network load. Mocha times out very quickly, so more expensive request will require a longer time out.
In other words, variance isn't a bug. If you're seeing a requests that hang, of course, that is a bug.
Application doesn't hang, need to provide timeout on mocha.opts
timeout is happening randomly on nodejs. We tried to put timeout on the opts, but it doesn't help. This timeout error could emerge when we run the same test in a loop ten times
Sample script: before(function(done) { fs.createReadStream(transformPath1). pipe(concatStream({encoding: 'string'}, function(source) { dbAdmin.config.transforms.write(transformName1, 'xquery', source). result(function(response){done();}, done); })); });
before(function(done) { fs.createReadStream(transformPath2). pipe(concatStream({encoding: 'string'}, function(source) { dbAdmin.config.transforms.write(transformName2, 'javascript', source). result(function(response){done();}, done); })); });
before(function(done) { db.documents.write({ uri: docuri, collections: ['coll0', 'coll1'], temporalCollection: 'temporalCollection', contentType: 'application/json', transform: [transformName1, {flag: 'sunshine'}], quality: 10, permissions: [ {'role-name':'app-user', capabilities:['read']}, {'role-name':'app-builder', capabilities:['read', 'update']} ], properties: {prop1:'foo', prop2:25}, content: { 'System': { 'systemStartTime' : "", 'systemEndTime' : "", }, 'Valid': { 'validStartTime': "2001-01-01T00:00:00", 'validEndTime': "2011-12-31T23:59:59" }, 'Address': "999 Skyway Park", 'uri': "javaSingleDoc1.json", id: 12, name: 'Jason' } } ).result(function(response){done();}, done); }); before(function(done) { db.documents.write({ uri: docuri2, collections: ['coll0', 'coll1'], temporalCollection: 'temporalCollection', contentType: 'application/json', transform: transformName2, quality: 10, permissions: [ {'role-name':'app-user', capabilities:['read']}, {'role-name':'app-builder', capabilities:['read', 'update']} ], properties: {prop1:'bar', prop2:50}, content: { 'System': { 'systemStartTime' : "", 'systemEndTime' : "", }, 'Valid': { 'validStartTime': "2001-01-01T00:00:00", 'validEndTime': "2011-12-31T23:59:59" }, 'Address': "888 Skyway Park", 'uri': "javaSingleDoc2.json", id: 12, name: 'Bourne' } } ).result(function(response){done();}, done); });