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/01/28 10:19:17 UTC

[GitHub] [pulsar] lhotari commented on a change in pull request #9356: [Test]Reduce rabbitmq failure rate

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



##########
File path: pulsar-io/rabbitmq/src/test/java/org/apache/pulsar/io/rabbitmq/sink/RabbitMQSinkTest.java
##########
@@ -65,7 +66,15 @@ public void TestOpenAndWriteSink() throws Exception {
         RabbitMQSink sink = new RabbitMQSink();
 
         // open should success
-        sink.open(configs, null);
+        // rabbitmq service may need time to initialize
+        Awaitility.await().atMost(Duration.ofSeconds(5)).until(() -> {
+            try {
+                sink.open(configs, null);
+                return true;

Review comment:
       One way to make the code cleaner is to use `.untilAsserted` that can be used for code that isn't expected to throw exceptions.
   I'd also recommend omitting `atMost(Duration.ofSeconds(5))` part. The default is 10 seconds by default and that should be fine 




----------------------------------------------------------------
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:
users@infra.apache.org