You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2017/05/10 22:39:44 UTC

curator git commit: In testNewMembers, make sure client connects to one of the nodes in the small cluster to avoid connection loss exceptions

Repository: curator
Updated Branches:
  refs/heads/CURATOR-411 96cecb2bb -> 5e97d0f3c


In testNewMembers, make sure client connects to one of the nodes in the small cluster to avoid connection loss exceptions


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/5e97d0f3
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/5e97d0f3
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/5e97d0f3

Branch: refs/heads/CURATOR-411
Commit: 5e97d0f3c53a403b898381e0a90cc0d0b8375c3f
Parents: 96cecb2
Author: randgalt <ra...@apache.org>
Authored: Thu May 11 00:39:40 2017 +0200
Committer: randgalt <ra...@apache.org>
Committed: Thu May 11 00:39:40 2017 +0200

----------------------------------------------------------------------
 .../curator/framework/imps/TestReconfiguration.java    | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/5e97d0f3/curator-framework/src/test/java/org/apache/curator/framework/imps/TestReconfiguration.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestReconfiguration.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestReconfiguration.java
index 5ed8a9b..83ebf74 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestReconfiguration.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestReconfiguration.java
@@ -293,14 +293,14 @@ public class TestReconfiguration extends BaseClassForTests
         cluster = new TestingCluster(5);
         List<TestingZooKeeperServer> servers = cluster.getServers();
         List<InstanceSpec> smallCluster = Lists.newArrayList();
-        for ( int i = 0; i < 4; ++i )   // only start 4 of the 5
+        for ( int i = 0; i < 3; ++i )   // only start 3 of the 5
         {
             TestingZooKeeperServer server = servers.get(i);
             server.start();
             smallCluster.add(server.getInstanceSpec());
         }
 
-        try ( CuratorFramework client = newClient())
+        try ( CuratorFramework client = newClient(new TestingCluster(smallCluster).getConnectString()))
         {
             client.start();
 
@@ -315,7 +315,7 @@ public class TestReconfiguration extends BaseClassForTests
             Assert.assertTrue(timing.awaitLatch(latch));
             byte[] newConfigData = client.getConfig().forEnsemble();
             QuorumVerifier newConfig = toQuorumVerifier(newConfigData);
-            Assert.assertEquals(newConfig.getAllMembers().size(), 4);
+            Assert.assertEquals(newConfig.getAllMembers().size(), 3);
             assertConfig(newConfig, smallCluster);
             Assert.assertEquals(EnsembleTracker.configToConnectionString(newConfig), ensembleProvider.getConnectionString());
         }
@@ -323,7 +323,12 @@ public class TestReconfiguration extends BaseClassForTests
 
     private CuratorFramework newClient()
     {
-        final AtomicReference<String> connectString = new AtomicReference<>(cluster.getConnectString());
+        return newClient(cluster.getConnectString());
+    }
+
+    private CuratorFramework newClient(String connectionString)
+    {
+        final AtomicReference<String> connectString = new AtomicReference<>(connectionString);
         ensembleProvider = new EnsembleProvider()
         {
             @Override