apupier opened a new pull request, #29329: URL: https://github.com/apache/camel/pull/29329
# Description CAMEL-26379: attempt to stabilize `QuartzCronRouteWithStartDateEndDateTest`. The test is reported flaky on CI (about 56% of the builds) with `mock://result Received message count 0, expected at least 2`, and it then takes about 32 seconds because of the 30 seconds mock timeout. **This is an attempt to stabilize the test: the failure could not be reproduced locally, so the effect is not proven and needs to be confirmed on CI.** ## Hypothesis The trigger `startAt`/`endAt` dates were computed when the `RouteBuilder` was configured, i.e. while the `CamelContext` was starting. On a loaded CI machine a slow startup (Quartz scheduler / JMX initialization) can consume part or all of the 4 seconds firing window. In the worst case `QuartzEndpoint.hasTriggerExpired()` considers that the trigger will never fire and does not schedule it, so no message is ever received. ## Change Add the route from the test method, once the `CamelContext` is started, so that the start and end dates are computed just before the trigger is created and are not affected by the context startup time. The start offset is reduced from 5s to 3s as it no longer needs to cover the startup; the firing window stays at 4 seconds. ## Local verification Under heavy CPU load (load average about 45 on 22 cores): - with the change: 20/20 passes (test class alone) - without the change: 20/20 passes (test class alone) and 8/8 passes (whole `camel-quartz` module, parallel as in CI) So the failure was not reproduced, with or without the change. # 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 ran the formatter (`mvn formatter:format impsort:sort`) on `camel-quartz`; no generated files are affected (test-only change). --- _AI-generated by IBM Bob 2.2.1 on behalf of @apupier._ -- 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]
