modified the config to own the connectionPool, transport, and a few other objects

This commit is contained in:
Spencer Alger
2013-10-18 09:40:55 -07:00
parent 0f9fa9c17c
commit 8cc87637e2
88 changed files with 1948 additions and 1338 deletions

View File

@ -4,7 +4,7 @@ describe('Connection Pool', function () {
var client, pool;
beforeEach(function () {
client = new es.Client();
pool = client.connectionPool;
pool = client.config.connectionPool;
});
describe('default settings', function () {
@ -13,52 +13,4 @@ describe('Connection Pool', function () {
pool.connections.dead.should.have.lengthOf(0);
});
});
describe('#setNodes', function () {
it('rejects anything accept an array of objects', function () {
(function () {
pool.setNodes([
'string'
]);
}).should.throw(TypeError);
(function () {
pool.setNodes('string');
}).should.throw(TypeError);
});
it('will clear out old nodes', function () {
// set an empty set of nodes
pool.setNodes([]);
pool.connections.alive.should.have.lengthOf(0);
pool.connections.dead.should.have.lengthOf(0);
});
it('will accept a new node list', function () {
var conns = pool.connections;
// set a list of 3 nodes
pool.setNodes([
{
hostname: 'es-cluster.us',
port: '9200'
},
{
hostname: 'es-cluster-1.us',
port: '9200'
},
{
hostname: 'es-cluster-2.us',
port: '9200'
}
]);
conns.alive.should.have.lengthOf(3);
conns.dead.should.have.lengthOf(0);
});
});
});