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 2012/12/13 08:18:53 UTC

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

Author: phunt
Date: Thu Dec 13 07:18:51 2012
New Revision: 1421095

URL: http://svn.apache.org/viewvc?rev=1421095&view=rev
Log:
ZOOKEEPER-1478. Small bug in QuorumTest.testFollowersStartAfterLeader( ) (Alexander Shraer via fpj, breed, phunt)

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

Modified: zookeeper/branches/branch-3.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/CHANGES.txt?rev=1421095&r1=1421094&r2=1421095&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.4/CHANGES.txt Thu Dec 13 07:18:51 2012
@@ -21,6 +21,9 @@ BUGFIXES:
   ZOOKEEPER-1553. Findbugs configuration is missing some dependencies
   (Sean Busbey via phunt)
 
+  ZOOKEEPER-1478. Small bug in QuorumTest.testFollowersStartAfterLeader( )
+  (Alexander Shraer via fpj, breed, phunt)
+
 IMPROVEMENTS:
 
   ZOOKEEPER-1564. Allow JUnit test build with IBM Java

Modified: zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/QuorumTest.java
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/QuorumTest.java?rev=1421095&r1=1421094&r2=1421095&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/QuorumTest.java (original)
+++ zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/QuorumTest.java Thu Dec 13 07:18:51 2012
@@ -23,6 +23,7 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 
 import org.apache.zookeeper.AsyncCallback;
 import org.apache.zookeeper.CreateMode;
@@ -313,22 +314,15 @@ public class QuorumTest extends ZKTestCa
         // break the quorum
         qu.shutdown(index);
 
+        // Wait until we disconnect to proceed
+        watcher.waitForDisconnected(CONNECTION_TIMEOUT);
+        
         // try to reestablish the quorum
         qu.start(index);
-        Assert.assertTrue("quorum reestablishment failed",
-                QuorumBase.waitForServerUp(
-                        "127.0.0.1:" + qu.getPeer(2).clientPort,
-                        CONNECTION_TIMEOUT));
 
-        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.
+        try{
+            watcher.waitForConnected(30000);      
+        } catch(TimeoutException e) {
             Assert.fail("client could not connect to reestablished quorum: giving up after 30+ seconds.");
         }