gnodet opened a new pull request, #24421:
URL: https://github.com/apache/camel/pull/24421

   ## Summary
   
   _Claude Code on behalf of Guillaume Nodet_
   
   Fix flaky WebSocket tests in `UndertowWsConsumerRouteTest` that fail 
intermittently on JDK 17.
   
   **Root cause**: JDK's `WebSocket.sendText()` returns a `CompletableFuture` 
that must complete before the next send. When two messages are sent in rapid 
succession on the same connection, the second send fails silently with 
`IllegalStateException` because `WebsocketTestClient.sendTextMessage()` ignores 
the returned future.
   
   **Fix**:
   - Replace `CountDownLatch`-based `assertTrue(await(10))` + subsequent 
assertions with **Awaitility** polling (`untilAsserted`) in `echo()`, 
`echoMulti()`, `sendToAll()`, and `connectionKeyList()`
   - For tests sending multiple messages on the same connection (`echo`, 
`connectionKeyList`), wait for the echo of the first message before sending the 
next, avoiding the JDK WebSocket pending-send conflict
   - Add `awaitility` test dependency to `camel-undertow`
   
   ## Test plan
   
   - [x] `UndertowWsConsumerRouteTest` passes (all 10 tests, 0 flakes)
   - [x] Ran `echo()` test 3x consecutively — all green
   - [x] Code formatting verified (`mvn formatter:format impsort:sort` — no 
changes needed)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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]

Reply via email to