Merge remote-tracking branch 'upstream/master' into browser_tests_for_travis
This commit is contained in:
@ -9,8 +9,7 @@ if (BROWSER) {
|
||||
}
|
||||
var argv = require('./argv');
|
||||
var server = require('./server');
|
||||
// var path = require('path');
|
||||
// var fs = require('fs');
|
||||
var fs = require('relative-fs').relativeTo(require('path').join(__dirname, '../../../'));
|
||||
var _ = require('../../../src/lib/utils');
|
||||
|
||||
// current client
|
||||
@ -65,10 +64,15 @@ module.exports = {
|
||||
: 'stdio',
|
||||
level: VERBOSE
|
||||
? 'trace'
|
||||
: 'warning',
|
||||
path: VERBOSE ? undefined : false
|
||||
: 'warning'
|
||||
};
|
||||
|
||||
if (logConfig && logConfig.type === 'tracer') {
|
||||
try {
|
||||
fs.unlinkSync('../../../elasticsearch-tracer.log');
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
// close existing client
|
||||
if (client) {
|
||||
client.close();
|
||||
|
||||
@ -8,6 +8,7 @@ describe('Http Connector', function () {
|
||||
var nock = require('nock');
|
||||
var sinon = require('sinon');
|
||||
var util = require('util');
|
||||
var KeepAliveAgent = require('agentkeepalive');
|
||||
|
||||
var http = require('http');
|
||||
var https = require('https');
|
||||
@ -55,8 +56,8 @@ describe('Http Connector', function () {
|
||||
// requestTimeout
|
||||
});
|
||||
|
||||
it('expects one the host to have a protocol of http or https', function () {
|
||||
expect(function () {
|
||||
it('expects the host to have a protocol of http or https', function () {
|
||||
(function () {
|
||||
var con = new HttpConnection(new Host('thrifty://es.com/stuff'));
|
||||
}).to.throwError(/invalid protocol/i);
|
||||
});
|
||||
@ -171,8 +172,9 @@ describe('Http Connector', function () {
|
||||
it('calls http based on the host', function (done) {
|
||||
var con = new HttpConnection(new Host('http://google.com'));
|
||||
con.request({}, function () {
|
||||
expect(http.request.callCount).to.eql(1);
|
||||
expect(https.request.callCount).to.eql(0);
|
||||
http.request.callCount.should.eql(1);
|
||||
https.request.callCount.should.eql(0);
|
||||
http.request.lastCall.args[0].agent.should.be.an.instanceOf(KeepAliveAgent);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@ -180,8 +182,9 @@ describe('Http Connector', function () {
|
||||
it('calls https based on the host', function (done) {
|
||||
var con = new HttpConnection(new Host('https://google.com'));
|
||||
con.request({}, function () {
|
||||
expect(http.request.callCount).to.eql(0);
|
||||
expect(https.request.callCount).to.eql(1);
|
||||
http.request.callCount.should.eql(0);
|
||||
https.request.callCount.should.eql(1);
|
||||
https.request.lastCall.args[0].agent.should.be.an.instanceOf(KeepAliveAgent.HttpsAgent);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user