[camel] branch master updated: Improve StreamResequencerTest stability

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[camel] branch master updated: Improve StreamResequencerTest stability

gnodet
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 720268f  Improve StreamResequencerTest stability
720268f is described below

commit 720268f9dddf9b9cce6214c5b448549f83c8baae
Author: Guillaume Nodet <[hidden email]>
AuthorDate: Fri Jun 5 12:03:49 2020 +0200

    Improve StreamResequencerTest stability
   
    The test is flaky because the two parallel senders can get out of sync by more than 100 ms and thus causing the resequencer to fail.
---
 .../resources/org/apache/camel/spring/processor/streamResequencer.xml | 2 +-
 .../test/java/org/apache/camel/processor/StreamResequencerTest.java   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/streamResequencer.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/streamResequencer.xml
index aac825e..8c28bfc 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/streamResequencer.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/streamResequencer.xml
@@ -29,7 +29,7 @@
     <route>
       <from uri="direct:start"/>
       <resequence>
-        <stream-config timeout="100" deliveryAttemptInterval="10"/>
+        <stream-config timeout="1000" deliveryAttemptInterval="10"/>
         <simple>${header.seqnum}</simple>
         <to uri="mock:result" />
       </resequence>
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java
index 8549b6e..7cfcda0 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java
@@ -96,7 +96,7 @@ public class StreamResequencerTest extends ContextTestSupport {
         return new RouteBuilder() {
             public void configure() {
                 // START SNIPPET: example
-                from("direct:start").resequence(header("seqnum")).stream().timeout(100).deliveryAttemptInterval(10).to("mock:result");
+                from("direct:start").resequence(header("seqnum")).stream().timeout(1000).deliveryAttemptInterval(10).to("mock:result");
                 // END SNIPPET: example
             }
         };
@@ -146,7 +146,7 @@ public class StreamResequencerTest extends ContextTestSupport {
             for (long i = start; i < end; i += increment) {
                 try {
                     // let's sleep randomly
-                    Thread.sleep(random.nextInt(20));
+                    Thread.sleep(random.nextInt(10));
                 } catch (InterruptedException e) {
                     Thread.currentThread().interrupt();
                 }