Added "extends" key to the jshint config files, so there is less repetition.
Mocha now runs from grunt, just run "grunt" Copied es-php's README.md, will modify later More logging around sending a request, including stack traces for debug messages Connections now manage their own state, and emit a "status changed" event which the connection pool listens for Fixed the custom errors Stream loggers will dump their buffered output to stderr when the process exits so that log messages will be sort of saved, File logger overrides this and writes to the file syncronously Added _.handler(), _.scheduled(), and _.makeBoundMethods() to the utils
This commit is contained in:
@ -1,28 +1,6 @@
|
||||
{
|
||||
"node": true,
|
||||
"extends": "../.jshintrc",
|
||||
|
||||
"bitwise": false,
|
||||
"curly": true,
|
||||
"eqnull": true,
|
||||
"eqeqeq": true,
|
||||
"forin": true,
|
||||
"immed": true,
|
||||
"expr": false,
|
||||
"indent": 2,
|
||||
"latedef": "nofunc",
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"undef": true,
|
||||
"quotmark": "single",
|
||||
"plusplus": false,
|
||||
"boss": true,
|
||||
"trailing": true,
|
||||
"laxbreak": true,
|
||||
"laxcomma": true,
|
||||
"validthis": true,
|
||||
"sub": true,
|
||||
"maxlen": 140,
|
||||
"-W030": true,
|
||||
"-W068": true,
|
||||
|
||||
|
||||
@ -0,0 +1,61 @@
|
||||
|
||||
var EsServer = require('../../mocks/es_server');
|
||||
var HttpConnection = require('../../../src/lib/connections/http');
|
||||
var errors = require('../../../src/lib/errors');
|
||||
|
||||
describe('overall timeout for the network connections', function () {
|
||||
|
||||
var server;
|
||||
var connection;
|
||||
|
||||
before(function (done) {
|
||||
|
||||
server = new EsServer();
|
||||
|
||||
server.routes.get['/timeout'] = function (req, res) {
|
||||
// wait for 10 seconds before responding, or the value in the timeout param
|
||||
var timeout = parseInt(req.parsedUrl.query.timeout, 10);
|
||||
if (isNaN(timeout)) {
|
||||
timeout = 10000;
|
||||
}
|
||||
|
||||
res.writeHead(200);
|
||||
|
||||
res.on('close', function() {
|
||||
clearInterval(dataInterval);
|
||||
clearTimeout(finTimeout);
|
||||
});
|
||||
|
||||
var dataInterval = setInterval(function () {
|
||||
res.write('.');
|
||||
}, 100);
|
||||
|
||||
var finTimeout = setTimeout(function () {
|
||||
clearInterval(dataInterval);
|
||||
res.end('good bye');
|
||||
}, timeout);
|
||||
};
|
||||
|
||||
server.on('online', function (port) {
|
||||
connection = new HttpConnection({
|
||||
hostname: 'localhost',
|
||||
port: port
|
||||
});
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it('should bail quickly', function (done) {
|
||||
this.timeout(1000);
|
||||
connection.request({
|
||||
path: '/timeout?timeout=1000',
|
||||
timeout: 100
|
||||
}, function (err, resp, status) {
|
||||
err.should.be.an.instanceof(errors.RequestTimeout);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@ -13,10 +13,9 @@ var argv = require('optimist')
|
||||
.default('dataPath', '/tmp/yaml-test-runner')
|
||||
.argv;
|
||||
|
||||
|
||||
if (argv.hostname || argv.port) {
|
||||
console.log('working with ES instance at ' + argv.hostname + ':' + argv.port);
|
||||
}
|
||||
// if (argv.hostname || argv.port) {
|
||||
// console.log('working with ES instance at ' + argv.hostname + ':' + argv.port);
|
||||
// }
|
||||
|
||||
// Where do the tests live?
|
||||
var TEST_DIR = path.resolve(__dirname, '../../../es_api_spec/test/');
|
||||
@ -31,7 +30,7 @@ var esServer = null;
|
||||
var client = null;
|
||||
|
||||
// location that the logger will write to
|
||||
var logFile = path.resolve(__dirname, '../integration-test.log');
|
||||
var logFile = path.resolve(__dirname, './log');
|
||||
|
||||
// empty all of the indices in ES please
|
||||
function clearIndices (done) {
|
||||
@ -67,6 +66,7 @@ before(function (done) {
|
||||
});
|
||||
|
||||
before(function () {
|
||||
Error.stackTraceLimit = Infinity;
|
||||
// create the client
|
||||
client = new es.Client({
|
||||
hosts: [
|
||||
@ -77,7 +77,7 @@ before(function () {
|
||||
],
|
||||
log: {
|
||||
type: 'file',
|
||||
level: ['error', 'debug', 'trace'],
|
||||
level: ['error', 'warning', 'trace'],
|
||||
path: logFile
|
||||
}
|
||||
});
|
||||
@ -391,7 +391,7 @@ ActionRunner.prototype = {
|
||||
rangeMatchesCurrentVersion(args.version, _.bind(function (match) {
|
||||
if (match) {
|
||||
this.skipping = true;
|
||||
console.log('skipping the rest of these actions' + (args.reason ? ' because ' + args.reason : ''));
|
||||
// console.log('skipping the rest of these actions' + (args.reason ? ' because ' + args.reason : ''));
|
||||
} else {
|
||||
this.skipping = false;
|
||||
}
|
||||
|
||||
0
test/integration/yaml-suite/log
Normal file
0
test/integration/yaml-suite/log
Normal file
@ -30,12 +30,7 @@ var pingResp = JSON.stringify({
|
||||
'tagline': 'You Know, for Search'
|
||||
});
|
||||
|
||||
function EsServer(config) {
|
||||
this.config = _.defaults(config || {}, {
|
||||
port: 0,
|
||||
data: '/'
|
||||
});
|
||||
|
||||
function EsServer() {
|
||||
var self = this;
|
||||
var server = http.createServer();
|
||||
|
||||
@ -77,7 +72,7 @@ function EsServer(config) {
|
||||
};
|
||||
|
||||
process.nextTick(function () {
|
||||
server.listen(self.config.port, function () {
|
||||
server.listen(0, function () {
|
||||
self.emit('online', server.address().port);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user