You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by ph...@apache.org on 2011/06/22 00:29:57 UTC

svn commit: r1138222 - in /zookeeper/branches/branch-3.3: CHANGES.txt src/java/test/org/apache/zookeeper/test/QuorumTest.java

Author: phunt
Date: Tue Jun 21 22:29:56 2011
New Revision: 1138222

URL: http://svn.apache.org/viewvc?rev=1138222&view=rev
Log:
ZOOKEEPER-1103. In QuorumTest, use the same "for ( .. try { break } catch { } )" pattern in testFollowersStartAfterLeaders as in testSessionMove. (Eugene Koontz via phunt)

Modified:
    zookeeper/branches/branch-3.3/CHANGES.txt
    zookeeper/branches/branch-3.3/src/java/test/org/apache/zookeeper/test/QuorumTest.java

Modified: zookeeper/branches/branch-3.3/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.3/CHANGES.txt?rev=1138222&r1=1138221&r2=1138222&view=diff
==============================================================================
--- zookeeper/branches/branch-3.3/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.3/CHANGES.txt Tue Jun 21 22:29:56 2011
@@ -4,6 +4,10 @@ BUGFIXES:
 
   ZOOKEEPER-1087. ForceSync VM arguement not working when set to "no" (Nate Putnam via breed)
 
+  ZOOKEEPER-1103. In QuorumTest, use the same "for ( .. try { break }
+  catch { } )" pattern in testFollowersStartAfterLeaders as in
+  testSessionMove. (Eugene Koontz via phunt)
+
 Release 3.3.3 - 2011-02-23
 Backward compatible changes:
 

Modified: zookeeper/branches/branch-3.3/src/java/test/org/apache/zookeeper/test/QuorumTest.java
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.3/src/java/test/org/apache/zookeeper/test/QuorumTest.java?rev=1138222&r1=1138221&r2=1138222&view=diff
==============================================================================
--- zookeeper/branches/branch-3.3/src/java/test/org/apache/zookeeper/test/QuorumTest.java (original)
+++ zookeeper/branches/branch-3.3/src/java/test/org/apache/zookeeper/test/QuorumTest.java Tue Jun 21 22:29:56 2011
@@ -289,11 +289,21 @@ public class QuorumTest extends QuorumBa
                 QuorumBase.waitForServerUp(
                         "127.0.0.1:" + qu.getPeer(2).clientPort,
                         CONNECTION_TIMEOUT));
-        Thread.sleep(1000);
 
-        // zk should have reconnected already
-        zk.create("/test", "test".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE,
-                CreateMode.PERSISTENT);
+
+        for (int i = 0; i < 30; i++) {
+            try {
+                zk.create("/test", "test".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE,
+                    CreateMode.PERSISTENT);
+                break;
+            } catch(KeeperException.ConnectionLossException e) {
+                Thread.sleep(1000);
+            }
+            // test fails if we still can't connect to the quorum after 30 seconds.
+            assertFalse("client could not connect to reestablished quorum: giving up after 30 seconds.",true);
+        }
+
+
         zk.close();
     }