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 08:34:31 UTC

[GitHub] [pulsar] Renkai opened a new pull request #9356: [Test]Reduce rabbitmq failure rate

Renkai opened a new pull request #9356:
URL: https://github.com/apache/pulsar/pull/9356


   The RabbitMQ service in tests startup asynchronously, so connect sometimes failed because the service is not prepared yet, try multiple times to reduce the failure rate.


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



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

Posted by GitBox <gi...@apache.org>.
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



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

Posted by GitBox <gi...@apache.org>.
Renkai commented on a change in pull request #9356:
URL: https://github.com/apache/pulsar/pull/9356#discussion_r565914258



##########
File path: pulsar-io/rabbitmq/src/test/java/org/apache/pulsar/io/rabbitmq/sink/RabbitMQSinkTest.java
##########
@@ -65,7 +64,23 @@ public void TestOpenAndWriteSink() throws Exception {
         RabbitMQSink sink = new RabbitMQSink();
 
         // open should success
-        sink.open(configs, null);

Review comment:
       @aahmed-se updated, PTAL again.




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



[GitHub] [pulsar] zymap merged pull request #9356: [Test]Reduce rabbitmq failure rate

Posted by GitBox <gi...@apache.org>.
zymap merged pull request #9356:
URL: https://github.com/apache/pulsar/pull/9356


   


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



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

Posted by GitBox <gi...@apache.org>.
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 
   
   Something like:
   `Awaitility.await().untilAsserted(() -> sink.open(configs, null));`




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



[GitHub] [pulsar] Renkai commented on pull request #9356: [Test]Reduce rabbitmq failure rate

Posted by GitBox <gi...@apache.org>.
Renkai commented on pull request #9356:
URL: https://github.com/apache/pulsar/pull/9356#issuecomment-769476220


   /pulsarbot run-failure-checks


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



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

Posted by GitBox <gi...@apache.org>.
aahmed-se commented on a change in pull request #9356:
URL: https://github.com/apache/pulsar/pull/9356#discussion_r565906636



##########
File path: pulsar-io/rabbitmq/src/test/java/org/apache/pulsar/io/rabbitmq/sink/RabbitMQSinkTest.java
##########
@@ -65,7 +64,23 @@ public void TestOpenAndWriteSink() throws Exception {
         RabbitMQSink sink = new RabbitMQSink();
 
         // open should success
-        sink.open(configs, null);

Review comment:
       Use https://github.com/awaitility/awaitility it's already part of the repo , add a setup method for rabbitmq.




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