apupier opened a new pull request, #29556: URL: https://github.com/apache/camel/pull/29556
# Description Part of [CAMEL-25891](https://issues.apache.org/jira/browse/CAMEL-25891) (shorten the build of `camel-spring-xml`, see the discussion in #28303). Follows the merged #29515 (tests safe to run in parallel in one JVM) and #29518 (faster seda polling in `SpringTestHelper`). Independent from the open #29553 (`FastPollSedaComponent`). ## Problem `SpringThrottlerTest` is the longest test class of `camel-spring-xml` (41 s). It extends `ConcurrentRequestsThrottlerTest` from `camel-core`, whose Java routes all call `.concurrentRequestsMode()`, but the routes in `throttler.xml` have no `mode` attribute. The default mode is `TotalRequests` (1 request per second), so the Spring tests ran a different throttler than the one they are meant to test and mostly waited for throttle periods (`testConfigurationWithChangingHeaderExpression` alone took 13 s, `testFifo` and `testPermitReleaseOnException` 7 s each). This dates back to CAMEL-20355 (commit 22151ef9e2a5), which added the throttling modes with `TotalRequests` as the default. It updated the Java test but not `throttler.xml`. `ThrottlerGroupingTest.xml` and `ThrottlerMethodCallTest.xml` have the same issue for their `camel-core` base classes (`concurrent.ThrottlingGroupingTest`, `concurrent.ThrottlerMethodCallTest`). The Java base test also had one route without the mode, `direct:release`, so `testPermitReleaseOnException` took 7 s in `camel-core` as well. ## Change (test code only) - `throttler.xml`: `mode="ConcurrentRequests"` on the 6 `<throttle>` elements - `ThrottlerGroupingTest.xml`: on the 5 elements - `ThrottlerMethodCallTest.xml`: on the element - `ConcurrentRequestsThrottlerTest` (`camel-core`): `.concurrentRequestsMode()` on `direct:release` ## Measurements `camel-spring-xml`, 1186 tests (0 failures, 26 skipped), 4 forks, sequential, 4 vCPU CI simulated with `taskset -c 0-3`, same machine, runs one after the other (noise about 10%). Both sides on top of the `FastPollSedaComponent` of #29553. | | before | after | |---|---|---| | wall time | 112 s, 111 s | 85 s, 82 s (about -28 s, -25%) | | `SpringThrottlerTest` | 41.1 s | 6.2 s | | `SpringThrottlerGroupingTest` | 8.5 s | 1.4 s | | `SpringThrottlerMethodCallTest` | - | 0.1 s | `SpringThrottlerTest` alone (1 fork): `testConfigurationWithChangingHeaderExpression` 13.3 s -> 1.7 s, `testFifo` 7.2 s -> 1.7 s, `testPermitReleaseOnException` 7.2 s -> 1.0 s, the three 4.2 s tests -> 0.6 s. `camel-core` `ConcurrentRequestsThrottlerTest`: `testPermitReleaseOnException` 7.1 s -> 0.85 s, 7 tests pass. The absolute baseline is higher than the 93 s measured earlier for the module (machine load), but the runs of each side were taken next to each other and are consistent. ## Remaining / caveats - `SpringSamplingThrottlerTest` (6 s) is a sampling throttler, the mode does not apply; not addressed. - `ConcurrentRequestsThrottlerTest` is time-bound (`@EnabledOnOs`, CAMEL-21438). Assertions wait on mocks so it should not be more fragile, but a few repeated CI runs are welcome. # 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. - [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. (formatter/impsort run on the module; test code only) # AI-assisted contributions - [x] This PR was prepared with IBM Bob 2.2.1 (AI agent); the commit has the `Co-authored-by` trailer. _IBM Bob 2.2.1 on behalf of @apupier. This description was AI-generated; please verify._ -- 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]
