devinbost commented on issue #6137: Large number of unstable Github tests for 
Pulsar
URL: https://github.com/apache/pulsar/issues/6137#issuecomment-579962632
 
 
   I noticed that there are many tests (including at least two of the tests 
above) that use this block of code that involves a Thread.sleep, which is often 
an anti-pattern in tests. 
   
   In MockedPulsarServiceBaseTest.java:
   ```
   public static boolean retryStrategically(Predicate<Void> predicate, int 
retryCount, long intSleepTimeInMillis)
               throws Exception {
           for (int i = 0; i < retryCount; i++) {
               if (predicate.test(null) || i == (retryCount - 1)) {
                   return true;
               }
               Thread.sleep(intSleepTimeInMillis + (intSleepTimeInMillis * i));
           }
           return false;
       }
   ```
   
   At least these two tests (referenced above) use `retryStrategically`:
   
   org.apache.pulsar.client.kafka.test.KafkaProducerSimpleConsumerTest
     -     testPulsarKafkaProducerWithSerializer
   
   org.apache.pulsar.functions.worker.PulsarFunctionE2ESecurityTest
     -     testAuthorizationWithAnonymousUser

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


With regards,
Apache Git Services

Reply via email to