You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/03/07 10:24:16 UTC

[GitHub] [camel-quarkus] aldettinger commented on issue #3584: Intermittent failure of `FileTest.idempotent`

aldettinger commented on issue #3584:
URL: https://github.com/apache/camel-quarkus/issues/3584#issuecomment-1060448463


   The same kind of issue happens in  `FileTest.filter`:
   
   ```
   org.awaitility.core.ConditionTimeoutException: org.apache.camel.quarkus.component.file.it.FileTest expected "Hello2" but was "" within 10 seconds.
   	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:164)
   	at org.awaitility.core.AbstractHamcrestCondition.await(AbstractHamcrestCondition.java:86)
   	at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:939)
   	at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:645)
   	at org.apache.camel.quarkus.component.file.it.FileTest.filter(FileTest.java:170)
   ```
   
   After investigations, the race condition could be made more probable with manual changes below:
   ```
            String result = mockEndpoint.getExchanges().stream().map(e -> e.getIn().getBody(String.class))
                    .collect(Collectors.joining(SEPARATOR));
   +        Log.info("Calling getFromMock/" + mockId + " result = " + result.length());
    
   -        mockEndpoint.reset();
   +        Thread.sleep(600);
   +        //mockEndpoint.reset();
    
            return result;
        }
   diff --git a/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileRoutes.java b/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileRoutes.java
   index 891339c..b03ab4a 100644
   --- a/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileRoutes.java
   +++ b/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileRoutes.java
   @@ -67,7 +67,7 @@ public class FileRoutes extends RouteBuilder {
                    .convertBodyTo(String.class).to("mock:idempotent");
    
            bindToRegistry("myFilter", new MyFileFilter<>());
   -        from(("file://target/filter?initialDelay=0&delay=10&filter=#myFilter"))
   +        from(("file://target/filter?initialDelay=2500&delay=10&filter=#myFilter"))
   ```
   
   At the end of the day, it could happen that `result` has length 0, right after the mock receive an exchange, but then `mockEndpoint.reset()` is called, thus clearing the received exchange from the mock. As such, the race condition triggers a missed exchange that break the testing logic.


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

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org