ammachado opened a new pull request, #30002:
URL: https://github.com/apache/camel/pull/30002

   # Description
   
   Part of [CAMEL-25893](https://issues.apache.org/jira/browse/CAMEL-25893) 
(under the CI umbrella CAMEL-24290). camel-core is on the critical path of the 
build and runs at about 16% CPU on CI ([analysis on 
CAMEL-24290](https://issues.apache.org/jira/browse/CAMEL-24290)).
   
   **What a profile of a local camel-core run showed** (170 s of test wall 
time):
   
   - The 62 `@Isolated` classes take only 86 s of test time, but each runs with 
every other worker idle. For 78 of the 170 s, at most one test class was 
running.
   - 48 of those 86 s fell outside the test bodies. In the multicast, recipient 
list and split *timeout* tests, the branch that must time out uses a fixed 
`delay()`. The timeout does not cancel that branch, so after the assertion, 
`tearDown()` stops the CamelContext and the graceful shutdown waits for the 
branch in one-second steps (`DefaultShutdownStrategy` polls every second). 
`MulticastParallelStreamingTimeoutTest` alone waited 10 s, until the forced 
shutdown.
   
   **Change** (14 test classes, no production code):
   
   - The branch that must time out now waits on a `CountDownLatch` instead of a 
fixed `delay()`. An `@AfterEach` releases the latch, then waits until the 
`InflightRepository` is empty, before `ContextTestSupport.tearDown()` runs. The 
fast branches and the timeouts are unchanged, so these tests stay `@Isolated`. 
A side benefit: the timed-out branch can no longer complete before the timeout 
on a loaded machine.
   - `MulticastParallelStreamingTimeoutTest` is no longer `@Isolated`. Its 
timeout is 10 s against a 500 ms branch. The isolation was added together with 
the real fix for its flakiness in CAMEL-23901 (#24417), which replaced an 
ordering assertion (`"CB"`). Its Awaitility-wrapped mock assertion becomes 
`MockEndpoint.assertIsSatisfied(context, 20, TimeUnit.SECONDS)`.
   
   **Result, locally on the same machine:**
   
   | | before | after |
   |---|---|---|
   | the 14 classes | ~47 s | 20.2 s |
   | camel-core test wall time | 170 s | 127 s |
   | seconds with at most one test class running | 78 | 32 |
   
   What is left in the 14 classes is mostly the configured timeouts themselves.
   
   **Verification:** the 14 classes passed in 5 consecutive runs, and the full 
camel-core suite passed (9351 tests, 0 failures, 44 skipped).
   
   **Not changed on purpose:** `ThrottlingGroupingTest` (asserts elapsed-time 
bounds; its sibling had a flaky-test fix in CAMEL-26489), the file-lock, 
thread-count and `SimpleLRUCacheTest` isolations (concrete reasons), and the 
isolated classes below 0.5 s (too little to gain).
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   
   - [x] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
     Test-only change in `core/camel-core`: I ran `formatter:format 
impsort:sort` and `-Psourcecheck verify` in that module (not the full tree), 
and `git status` was clean afterwards.
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code) on behalf of 
Adriano Machado (@ammachado)
   
   _This was generated by an AI agent and may contain inaccuracies. Please 
verify before relying on it._


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to