Guillaume Nodet created CAMEL-23893:
---------------------------------------

             Summary: Flaky SpringFileWatcherTest.testDefaultConfig on JDK 25
                 Key: CAMEL-23893
                 URL: https://issues.apache.org/jira/browse/CAMEL-23893
             Project: Camel
          Issue Type: Bug
          Components: camel-file-watch
            Reporter: Guillaume Nodet


SpringFileWatcherTest.testDefaultConfig fails consistently on JDK 25 (3/3 
attempts with surefire.rerunFailingTestsCount=2) while passing on JDK 17.

The test expects exactly 2 events (two MODIFY events from two Files.write() 
calls) but receives 3 on JDK 25. The root cause is that JDK 25's WatchService 
initializes faster and delivers a CREATE event for the file created in 
@BeforeEach, producing 3 events total (1 CREATE + 2 MODIFY). Additionally, the 
test used Thread.sleep(50) between writes, which is too short for CI and does 
not guarantee the file hasher processes the first write before the second.

The fix changes setExpectedCount(2) to expectedMinimumMessageCount(2) to 
tolerate the additional CREATE event, replaces Thread.sleep(50) with 
Awaitility, and increases the result wait time for CI robustness.

CI evidence: [run 
28625549853|https://github.com/apache/camel/actions/runs/28625549853], job 
build (25, false).

Fix: [PR #24403|https://github.com/apache/camel/pull/24403]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to