lhotari commented on a change in pull request #9965:
URL: https://github.com/apache/pulsar/pull/9965#discussion_r597187494



##########
File path: 
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/RawReaderTest.java
##########
@@ -357,14 +359,14 @@ public void testAcknowledgeWithProperties() throws 
Exception {
 
         PersistentTopic topicRef = (PersistentTopic) 
pulsar.getBrokerService().getTopicReference(topic).get();
         ManagedLedger ledger = topicRef.getManagedLedger();
-        for (int i = 0; i < 30; i++) {
-            if 
(ledger.openCursor(subscription).getProperties().get("foobar").equals(0xdeadbeefdecaL))
 {
-                break;
-            }
-            Thread.sleep(100);
-        }
-        
Assert.assertEquals(ledger.openCursor(subscription).getProperties().get("foobar"),
-                Long.valueOf(0xdeadbeefdecaL));
+
+        Awaitility.await()
+                .atMost(5, TimeUnit.SECONDS)
+                .untilAsserted(() ->

Review comment:
       sometimes, it might be necessary to also add 
[`.ignoreExceptions()`](https://javadoc.io/doc/org.awaitility/awaitility/latest/org/awaitility/core/ConditionFactory.html#ignoreExceptions--)
 . Perhaps that would be useful if there's a chance that 
`ledger.openCursor(subscription).getProperties().get("foobar")` throws an 
exception?
   By default, Awaitility will only retry by catching java.lang.AssertionErrors.




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to