You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/07/16 15:10:24 UTC

[GitHub] [pulsar] eolivelli commented on a change in pull request #11281: [tests] use Awaitility replace Thread.sleep for pulsar-broker.

eolivelli commented on a change in pull request #11281:
URL: https://github.com/apache/pulsar/pull/11281#discussion_r671322733



##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/service/SubscriptionSeekTest.java
##########
@@ -531,7 +532,7 @@ public void testOnlyCloseActiveConsumerForSingleActiveConsumerDispatcherWhenSeek
         assertEquals(connectedSinceSet.size(), 2);
         consumer1.seek(MessageId.earliest);
         // Wait for consumer to reconnect
-        Thread.sleep(1000);
+        Awaitility.await().until(() -> consumer1.isConnected() == true);

Review comment:
       nit:
   replace "consumer1.isConnected() == true" with `consumer1::isConnected`

##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/namespace/OwnershipCacheTest.java
##########
@@ -355,9 +356,9 @@ public void testRemoveOwnership() throws Exception {
         assertEquals(cache.getOwnedBundles().size(), 1);
         cache.removeOwnership(bundle);
         Thread.sleep(500);
-        assertTrue(cache.getOwnedBundles().isEmpty());
+        Awaitility.await().untilAsserted(() -> assertTrue(cache.getOwnedBundles().isEmpty()));
+
 
-        Thread.sleep(500);

Review comment:
       probably you have to use `Awaitility.await().untilAsserted` for the line below.
   
   because you are dropping this "sleep" as well




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org