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

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


The following commit(s) were added to refs/heads/main by this push:
     new d6d1b2892cc5 CAMEL-27540: camel-ftp - fix flaky 
SftpProducerStopDuringHungUploadIT
d6d1b2892cc5 is described below

commit d6d1b2892cc58f81f1a2d461412a44f9c114a324
Author: AurĂ©lien Pupier <[email protected]>
AuthorDate: Wed Nov 25 11:33:59 2026 +0100

    CAMEL-27540: camel-ftp - fix flaky SftpProducerStopDuringHungUploadIT
    
    Awaitility fails an await() when any thread of the JVM throws an uncaught
    exception, whether or not it is related to the condition awaited. The NIO2
    event threads of an embedded SSHD server that is being stopped (the one of
    a previous test, or the one of the test itself) throw
    "IllegalStateException: Executor has been shut down" when a read completes
    (NoCloseExecutor.execute), which made the three tests that use await()
    fail about 2% of the time:
    
    - stopOutsideForcedShutdownWaitsForUpload
    - stopDoesNotWaitForUploadBlockedWritingToHalfOpenConnection
    - gracefulStopWaitsForUploadOfRouteWhoseConsumerStopsRightAway
    
    Use dontCatchUncaughtExceptions() on the two await() calls of the test,
    as other tests of the project (camel-mllp) do.
    
    Co-authored-by: IBM Bob <[email protected]>
---
 .../remote/sftp/integration/SftpProducerStopDuringHungUploadIT.java  | 5 +++++
 1 file changed, 5 insertions(+)

diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpProducerStopDuringHungUploadIT.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpProducerStopDuringHungUploadIT.java
index 6a79e15da944..93e629a22bb2 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpProducerStopDuringHungUploadIT.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpProducerStopDuringHungUploadIT.java
@@ -134,6 +134,7 @@ class SftpProducerStopDuringHungUploadIT extends 
CamelTestSupport {
         // the proxy stops reading after the first MB of the upload, the TCP 
buffers fill, and the write blocks
         try {
             await().atMost(20, TimeUnit.SECONDS).during(500, 
TimeUnit.MILLISECONDS)
+                    .dontCatchUncaughtExceptions()
                     .until(() -> proxy.isFrozen() && 
isWritingToSocket(uploader.get()));
         } catch (ConditionTimeoutException e) {
             fail("The upload should block writing to the socket, frozen: " + 
proxy.isFrozen() + ", the upload is at: "
@@ -209,10 +210,14 @@ class SftpProducerStopDuringHungUploadIT extends 
CamelTestSupport {
         assertNull(exchange.getException(), "The exchange should complete");
     }
 
+    // The await must not fail on an uncaught exception of another thread of 
the JVM (Awaitility does by default): the
+    // NIO2 threads of an embedded server that is shut down, such as the one 
of a previous test, throw "Executor has been
+    // shut down" when a read completes, which has nothing to do with the 
condition awaited here (CAMEL-27540).
     private Exchange assertStopWaitsForUploadThatThenCompletes(Future<?> stop, 
Future<Exchange> upload) throws Exception {
         // well after the 1 s after which the stop disconnects in a forced 
shutdown
         try {
             await().atMost(5, TimeUnit.SECONDS).during(3, TimeUnit.SECONDS)
+                    .dontCatchUncaughtExceptions()
                     .until(() -> !stop.isDone() && !upload.isDone());
         } catch (ConditionTimeoutException e) {
             fail("The stop should wait for the upload, the stop returned: " + 
stop.isDone() + ", the upload ended: "

Reply via email to