This is an automated email from the ASF dual-hosted git repository.
gnodet 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 b353c1760f14 CAMEL-24618: Fix flaky
SpringFileAntPathMatcherRemoteFileFilterTest (#26120)
b353c1760f14 is described below
commit b353c1760f14249652d9f5f5d9659f5a0822948d
Author: Guillaume Nodet <[email protected]>
AuthorDate: Mon Sep 7 22:18:28 2026 +0200
CAMEL-24618: Fix flaky SpringFileAntPathMatcherRemoteFileFilterTest (#26120)
Fix two flakiness root causes:
1. State contamination (expected <1> but was <9>): The FTP consumer had
no delete option, so files accumulated across test retries since
FtpServiceExtension.afterAll() is a no-op and the FTP server
directories are never reset. Added delete=true to the FTP consumer
URI so files are removed after processing.
2. Timing race (expected <1> but was <0>): The consumer had
initialDelay=2000ms which, combined with the default
resultWaitTime, could cause the mock assertion to expire before
the first poll completed on slow CI. Changed initialDelay to 0
and set an explicit resultWaitTime of 30 seconds.
---
.../itest/ftp/SpringFileAntPathMatcherRemoteFileFilterTest.java | 7 ++++++-
.../ftp/SpringFileAntPathMatcherRemoteFileFilterTest-context.xml | 4 +++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git
a/tests/camel-itest/src/test/java/org/apache/camel/itest/ftp/SpringFileAntPathMatcherRemoteFileFilterTest.java
b/tests/camel-itest/src/test/java/org/apache/camel/itest/ftp/SpringFileAntPathMatcherRemoteFileFilterTest.java
index 383de7de8509..87877d123b5b 100644
---
a/tests/camel-itest/src/test/java/org/apache/camel/itest/ftp/SpringFileAntPathMatcherRemoteFileFilterTest.java
+++
b/tests/camel-itest/src/test/java/org/apache/camel/itest/ftp/SpringFileAntPathMatcherRemoteFileFilterTest.java
@@ -16,6 +16,9 @@
*/
package org.apache.camel.itest.ftp;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
@@ -46,6 +49,8 @@ public class SpringFileAntPathMatcherRemoteFileFilterTest {
protected String expectedBody = "Godday World";
@Autowired
+ protected CamelContext context;
+ @Autowired
protected ProducerTemplate template;
@EndpointInject("ref:myFTPEndpoint")
protected Endpoint inputFTP;
@@ -63,6 +68,6 @@ public class SpringFileAntPathMatcherRemoteFileFilterTest {
template.sendBodyAndHeader(inputFTP, "Day world", Exchange.FILE_NAME,
"day.xml");
template.sendBodyAndHeader(inputFTP, expectedBody, Exchange.FILE_NAME,
"subfolder/foo/godday.txt");
- result.assertIsSatisfied();
+ MockEndpoint.assertIsSatisfied(context, 30, TimeUnit.SECONDS);
}
}
diff --git
a/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFileAntPathMatcherRemoteFileFilterTest-context.xml
b/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFileAntPathMatcherRemoteFileFilterTest-context.xml
index 4ec8f8ba5fc8..b30491466955 100644
---
a/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFileAntPathMatcherRemoteFileFilterTest-context.xml
+++
b/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFileAntPathMatcherRemoteFileFilterTest-context.xml
@@ -30,7 +30,9 @@
<template id="camelTemplate"/>
<!-- use myFilter as filter to allow setting ANT paths for which files
to scan for -->
- <endpoint id="myFTPEndpoint"
uri="ftp://admin@localhost:${SpringFileAntPathMatcherRemoteFileFilterTest.ftpPort}/antpath?password=admin&recursive=true&delay=10000&initialDelay=2000&filter=#myAntFilter"/>
+ <!-- delete=true prevents state contamination: files are removed after
processing so they
+ don't accumulate across retries (FtpServiceExtension never resets
the FTP directory) -->
+ <endpoint id="myFTPEndpoint"
uri="ftp://admin@localhost:${SpringFileAntPathMatcherRemoteFileFilterTest.ftpPort}/antpath?password=admin&recursive=true&delay=10000&initialDelay=0&delete=true&filter=#myAntFilter"/>
<route>
<from uri="ref:myFTPEndpoint"/>