apupier opened a new pull request, #30482: URL: https://github.com/apache/camel/pull/30482
## Description Fixes the flaky `CosmosDbContainerOperationsIT` ([CAMEL-27276](https://issues.apache.org/jira/browse/CAMEL-27276)): ``` org.opentest4j.AssertionFailedError: expected: <2> but was: <1> at CosmosDbContainerOperationsIT.testCreateItems(CosmosDbContainerOperationsIT.java:163) ``` **Cause:** `testCreateItems` and `testUpsertItems` called `blockFirst()` on the `Flux` returned by `createItems()` / `upsertItems()`. These Fluxes write the items concurrently (`flatMap`), and `blockFirst()` returns on the first response and cancels the subscription, so the write of the remaining item could be cancelled before completing. The following read then found 1 item instead of 2. **Fix:** wait for all the responses with `collectList().block()`. Test-only change, the main code is unchanged (callers that subscribe normally are not affected by the cancellation). The other `blockFirst()` usages in the module are read-only queries expecting a single result and are not impacted. **Reproduction** (Floci AZ container, machine loaded with 44 busy-loop processes on 22 cores, each test method run 20 times): | Test | before | after | |---|---|---| | `testCreateItems` | 7/20 failed | 20/20 passed | | `testUpsertItems` | 2/20 failed | 20/20 passed | ## 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. --- _Claude Code is not involved; this PR was prepared by IBM Bob 2.2.1 (AI) 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]
