apupier opened a new pull request, #29345: URL: https://github.com/apache/camel/pull/29345
# Description `ConsulMasterIT` still failed on Jenkins with `expected: <3> but was: <0>` after #29228 (namespaces, thread-safe results, `finally`), so that change did not cover this failure. The three Consul cluster ITs started the `CamelContext` inside `Awaitility.untilAsserted(() -> assertDoesNotThrow(context::start))`. This comes from CAMEL-19516, which only replaced the `Thread.sleep()` of the random delay before the start (the `context.start()` that follows was kept, so the context was started twice). On a slow machine the start can take longer than the 10 seconds default timeout of Awaitility. Awaitility then interrupts the thread, which aborts the Consul requests of the start (`InterruptedIOException` in `session/info`), so none of the nodes ever takes part in the leader election and no node completes. I reproduced it by running `ConsulMasterIT` with all CPUs saturated: 1 failure in 6 runs, with exactly this log (`ConsulException ... failed due to IOException` caused by `InterruptedIOException`, then `ConditionTimeoutException ... within 10 seconds`). With this fix, 10 runs under the same load all passed. Changes, applied to `ConsulMasterIT`, `ConsulClusteredRoutePolicyIT` and `ConsulClusteredRoutePolicyFactoryIT`: - the random delay is applied with the scheduler that already runs the nodes (`SCHEDULER.schedule(...)`), so the startup order still changes for each test, without `Thread.sleep()` or Awaitility - the context is started once with `Assertions.assertDoesNotThrow(context::start)`, which keeps the check that the start does not throw and cannot be interrupted anymore - an `AssertionError` of a node is logged like any other error (`catch (Exception | AssertionError e)`), as it would otherwise be lost in the `Future` of the scheduler # 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). https://issues.apache.org/jira/browse/CAMEL-26381 # 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. (test-only change in `camel-consul`, formatter and import sorter applied) # 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. _AI-assisted: 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]
