[Groonga-commit] droonga/express-droonga at 7a131dc [master] Add tests for updating of hostNames

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Oct 22 17:52:37 JST 2014


YUKI Hiroshi	2014-10-22 17:52:37 +0900 (Wed, 22 Oct 2014)

  New Revision: 7a131dc4ca2659f7dbe2d1e42dea56ddd9283241
  https://github.com/droonga/express-droonga/commit/7a131dc4ca2659f7dbe2d1e42dea56ddd9283241

  Message:
    Add tests for updating of hostNames

  Modified files:
    test/droonga-protocol/connection-pool.test.js

  Modified: test/droonga-protocol/connection-pool.test.js (+41 -0)
===================================================================
--- test/droonga-protocol/connection-pool.test.js    2014-10-22 17:52:23 +0900 (68c5fe7)
+++ test/droonga-protocol/connection-pool.test.js    2014-10-22 17:52:37 +0900 (ac262e0)
@@ -109,4 +109,45 @@ suite('ConnectionPool', function() {
                         connections[5].hostName]);
     });
   });
+
+  suite('updating of hostNames', function() {
+    var connectionPool;
+
+    teardown(function() {
+      if (connectionPool) {
+        connectionPool.closeAll();
+        connectionPool = undefined;
+      }
+    });
+
+    test('no change', function() {
+      connectionPool = new ConnectionPool({
+        hostNames: [
+          '127.0.0.1'
+        ]
+      });
+      var beforeConnection = connectionPool.get();
+
+      connectionPool.hostNames = ['127.0.0.1'];
+
+      var afterConnection = connectionPool.get();
+      assert.equal(afterConnection.hostName, beforeConnection.hostName);
+      assert.isFalse(beforeConnection.closed);
+    });
+
+    test('replace', function() {
+      connectionPool = new ConnectionPool({
+        hostNames: [
+          '127.0.0.1'
+        ]
+      });
+      var beforeConnection = connectionPool.get();
+
+      connectionPool.hostNames = ['127.0.0.2'];
+
+      var afterConnection = connectionPool.get();
+      assert.notEqual(afterConnection.hostName, beforeConnection.hostName);
+      assert(beforeConnection.closed);
+    });
+  });
 });
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index