gnodet opened a new pull request, #24590: URL: https://github.com/apache/camel/pull/24590
## Summary _Claude Code on behalf of gnodet_ Fixes the persistent flakiness of `HazelcastReplicatedmapConsumerTest` (18% failure rate on Develocity — 35/194 runs failing). The prior fix ([CAMEL-22506](https://issues.apache.org/jira/browse/CAMEL-22506)) added `map.clear()` + mock reset in `@BeforeEach`, but that approach itself introduces the flakiness because `clear()` fires async REMOVED events through the still-active Hazelcast entry listener. **Root cause:** `map.clear()` in `@BeforeEach` fires async REMOVED events that bleed between tests because the Hazelcast `EntryListener` is still registered. Additionally, `testRemove()` calls `map.remove()` immediately after `map.put()` without waiting for the ADDED event to be processed, creating a race condition. **Fix:** - **`@BeforeEach`**: Stop routes before clearing the map to deregister the entry listener (via `HazelcastReplicatedmapConsumer.doStop()`), preventing stale REMOVED events from reaching mock endpoints. Restart routes after clearing and resetting mocks. - **`testRemove()`**: Wait for the ADDED event to be delivered before calling `remove()`, eliminating the put/remove race. - **`testEvict()`**: Replace redundant Awaitility-wrapped `MockEndpoint.assertIsSatisfied()` with the native latch-based timed assertion (per project conventions — Awaitility polls on top of an already-waiting mechanism). ## Test plan - [x] All 3 tests pass locally - [x] Validated with **100 consecutive runs — 0 failures** (vs. ~18 expected failures without fix) - [x] Code formatted with `mvn formatter:format impsort:sort` - [ ] CI build passes -- 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]
