ivankelly commented on a change in pull request #775: Tests wait for client to 
see started bookie
URL: https://github.com/apache/bookkeeper/pull/775#discussion_r153615386
 
 

 ##########
 File path: 
bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperTestClient.java
 ##########
 @@ -50,13 +57,53 @@ public BookieClient getBookieClient() {
     }
 
     /**
-     * Force a read to zookeeper to get list of bookies.
-     *
-     * @throws InterruptedException
-     * @throws KeeperException
+     * Wait for the bookie to appear in any set
      */
-    public void readBookiesBlocking()
-            throws InterruptedException, BKException {
-        bookieWatcher.readBookiesBlocking();
+    public CompletableFuture<?> waitForBookie(BookieSocketAddress b)
+            throws Exception {
+        return CompletableFuture.anyOf(
+                waitForReadOnlyBookie(b),
+                waitForWritableBookie(b));
+    }
+
+    public CompletableFuture<?> waitForReadOnlyBookie(BookieSocketAddress b)
+            throws Exception {
+        return waitForBookieInSet(b, false);
+    }
+
+    public CompletableFuture<?> waitForWritableBookie(BookieSocketAddress b)
+            throws Exception {
+        return waitForBookieInSet(b, true);
+    }
+
+    /**
+     * Wait for bookie to appear in either the writable set of bookies,
+     * or the read only set of bookies. Also ensure that it doesn't exist
+     * in the other set before completing.
+     */
+    private CompletableFuture<?> waitForBookieInSet(BookieSocketAddress b,
 
 Review comment:
   will remove this method.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to