apupier opened a new pull request, #28184: URL: https://github.com/apache/camel/pull/28184
# Description This PR addresses port collision flakiness in CXF tests ([CAMEL-25440](https://issues.apache.org/jira/browse/CAMEL-25440)) and speeds up the `camel-cxf` test suite through fork parallelization ([CAMEL-25880](https://issues.apache.org/jira/browse/CAMEL-25880)). ### 1. Port Collision and Undertow Flakiness Fix (CAMEL-25440) - **Removed `DontClosePort=true`**: In `CXFTestSupport`, `org.apache.cxf.transports.http_undertow.DontClosePort` was previously set to `true`, preventing Undertow from closing TCP listeners upon test teardown. This left lingering sockets and caused `BindException: Address already in use` in subsequent tests. - **Switched to Ephemeral Port Allocation**: Replaced deprecated `AvailablePortFinder.getNextRandomAvailable()` range probing with `AvailablePortFinder.find()` to use OS kernel-assigned ephemeral ports (`port 0`) and register reservations. - **Updated Javadoc**: Corrected the outdated Javadoc comment in `CXFTestSupport`. ### 2. Fork Parallelization and Build Speedup (CAMEL-25880) - Added `<camel.surefire.forkCount>0.5C</camel.surefire.forkCount>` to `components/camel-cxf/pom.xml`. - Because `reuseForks=false` is configured in `camel-cxf-spring-soap` and `camel-cxf-spring-rest`, `forkCount=1` sequentially created and destroyed a JVM per test class (~50 test classes in `camel-cxf-spring-soap`), creating a substantial sequential JVM startup bottleneck. - Parallelizing forks across available CPU cores eliminates this bottleneck, while clean socket release avoids inter-test port collisions. --- ### Benchmark Results (`components/camel-cxf`, all tests passing) | Configuration | Sequential Reactor (without `-T1C`) | Parallel Reactor (with `-T1C`) | Speedup | | :--- | :---: | :---: | :---: | | **Baseline** | > 05:00 min (timeout) | 03:57 min | 1.0x | | **Optimized** | **02:06 min** | **01:46 min** | **~2.24x** | **Module Breakdown (with `-T1C`):** - `camel-cxf-spring-soap`: **01:04 min** (down from 03:18 min, **3.1x faster**) - `camel-cxf-spring-rest`: **29.1 s** (down from 59.4 s, **2.0x faster**) _IBM Bob on behalf of Aurélien Pupier_ # Target - [ ] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [ ] 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). <!-- # *Note*: trivial changes like, typos, minor documentation fixes and other small items do not require a JIRA issue. In this case your pull request should address just this issue, without pulling in other changes. --> # Apache Camel coding standards and style - [ ] I checked that each commit in the pull request has a meaningful subject line and body. <!-- If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue. --> - [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. <!-- You can run the aforementioned command in your module so that the build auto-formats your code. This will also be verified as part of the checks and your PR may be rejected if if there are uncommited changes after running `mvn clean install -DskipTests`. You can learn more about the contribution guidelines at https://github.com/apache/camel/blob/main/CONTRIBUTING.md --> # AI-assisted contributions - [ ] 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. -- 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]
