Guillaume Nodet created CAMEL-24021:
---------------------------------------
Summary: Fix flaky VertxWebsocketHandshakeHeadersTest
Key: CAMEL-24021
URL: https://issues.apache.org/jira/browse/CAMEL-24021
Project: Camel
Issue Type: Bug
Components: camel-vertx-websocket
Reporter: Guillaume Nodet
The test VertxWebsocketHandshakeHeadersTest.testHandshakeHeadersAsConsumer is
flaky on CI. In the last 12 days, it has 8 failures and 7 flaky runs out of 295
total runs.
Root cause: Race condition in testHandshakeHeadersAsConsumer where MockEndpoint
expectations are set AFTER context.start() and after the CountDownLatch
completes. Messages from the server can arrive and be consumed before the mock
expectations are configured, causing assertion failures like:
- "mock://result Message with body Hello World was expected but not found in
[Ping]" (only one of two messages received)
- "mock://result Received message count. Expected: <2> but was: <0>" (no
messages received)
Fix: Set up MockEndpoint expectations BEFORE starting the CamelContext, and use
MockEndpoint.assertIsSatisfied(context, 30, TimeUnit.SECONDS) for timed
assertions.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)