Przeglądaj źródła

Fixed a problem introduced by the first patch for ZOOKEEPER-1103 (phunt)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1138595 13f79535-47bb-0310-9956-ffa450edef68
Patrick D. Hunt 14 lat temu
rodzic
commit
f6cb87e368

+ 5 - 3
src/java/test/org/apache/zookeeper/test/QuorumTest.java

@@ -317,20 +317,22 @@ public class QuorumTest extends QuorumBase {
                         "127.0.0.1:" + qu.getPeer(2).clientPort,
                         CONNECTION_TIMEOUT));
 
-
+        boolean success = false;
         for (int i = 0; i < 30; i++) {
             try {
                 zk.create("/test", "test".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE,
                     CreateMode.PERSISTENT);
+                success = true;
                 break;
             } catch(KeeperException.ConnectionLossException e) {
                 Thread.sleep(1000);
             }
+        }
+        if (!success) {
             // test fails if we still can't connect to the quorum after 30 seconds.
-            Assert.assertFalse("client could not connect to reestablished quorum: giving up after 30 seconds.",true);
+            Assert.fail("client could not connect to reestablished quorum: giving up after 30+ seconds.");
         }
 
-
         zk.close();
     }