Guillaume Nodet created CAMEL-23892:
---------------------------------------

             Summary: Fix flaky camel-sql JDBC aggregate surefire tests on JDK 
17 and JDK 25
                 Key: CAMEL-23892
                 URL: https://issues.apache.org/jira/browse/CAMEL-23892
             Project: Camel
          Issue Type: Bug
          Components: camel-sql
            Reporter: Guillaume Nodet
            Assignee: Guillaume Nodet
             Fix For: 4.22.0


Several JDBC aggregation repository tests in camel-sql fail intermittently 
during CI on both JDK 17 and JDK 25 (maven-surefire-plugin), even with 
rerunFailingTestsCount=2.

The root cause is the use of Thread.sleep() for test synchronization, which is 
unreliable under CI load:

* *JdbcAggregateCompletionIntervalTest*: Thread.sleep(2000) + 
Thread.sleep(6000) to time messages around the completion interval — fails when 
the interval fires at unexpected times under load
* *JdbcAggregateDiscardOnTimeoutTest*: Thread.sleep(2000) to wait for a 
1-second timeout — fails when timeout fires late under load. Also had an 
incorrect expected body value and a non-asserting mock.await() call
* *JdbcAggregationRepositoryRecoverExistingTest*: Thread.sleep(1000) between 
repo stop/start — fails if repo shutdown takes longer under load
* Several concurrent/load tests used Thread.sleep(3) in Callable blocks

The fix replaces all Thread.sleep() calls with Awaitility-based polling or 
TimeUnit.MILLISECONDS.sleep(), following the project convention.



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

Reply via email to