YUKI Hiroshi
null+****@clear*****
Wed Oct 22 18:05:03 JST 2014
YUKI Hiroshi 2014-10-22 18:05:03 +0900 (Wed, 22 Oct 2014) New Revision: aa67b0944c9868447b8bd5ed485e14b943c00782 https://github.com/droonga/express-droonga/commit/aa67b0944c9868447b8bd5ed485e14b943c00782 Message: Add test for the case that the list of engine hosts partially replaced Modified files: test/droonga-protocol/connection-pool.test.js Modified: test/droonga-protocol/connection-pool.test.js (+19 -1) =================================================================== --- test/droonga-protocol/connection-pool.test.js 2014-10-22 17:57:12 +0900 (ac262e0) +++ test/droonga-protocol/connection-pool.test.js 2014-10-22 18:05:03 +0900 (b56316a) @@ -135,7 +135,7 @@ suite('ConnectionPool', function() { assert.isFalse(beforeConnection.closed); }); - test('replace', function() { + test('replace all', function() { connectionPool = new ConnectionPool({ hostNames: [ '127.0.0.1' @@ -149,5 +149,23 @@ suite('ConnectionPool', function() { assert.notEqual(afterConnection.hostName, beforeConnection.hostName); assert(beforeConnection.closed); }); + + test('replace partially', function() { + connectionPool = new ConnectionPool({ + hostNames: [ + '127.0.0.1', + '127.0.0.2' + ] + }); + var willClosedConnection = connectionPool.getConnectionFor('127.0.0.1'); + var willBeKeptConnection = connectionPool.getConnectionFor('127.0.0.2'); + + connectionPool.hostNames = ['127.0.0.2', '127.0.0.3']; + + assert.deepEqual([willClosedConnection.closed, + willBeKeptConnection.closed], + [true, + false]); + }); }); }); -------------- next part -------------- HTML����������������������������...Télécharger