gnodet-bot commented on code in PR #30498:
URL: https://github.com/apache/camel/pull/30498#discussion_r4644542878
##########
components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncContinuationTimeoutTest.java:
##########
@@ -39,21 +37,15 @@ public class JettyAsyncContinuationTimeoutTest extends
BaseJettyTest {
public void testJettyAsyncTimeout() throws Exception {
getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
- StopWatch watch = new StopWatch();
CamelExecutionException e = assertThrows(CamelExecutionException.class,
() ->
template.requestBody("http://localhost:{{port}}/myservice", null, String.class),
"Should have thrown an exception");
LOG.info("Timeout hit and client got reply with failure status code");
- long taken = watch.taken();
-
HttpOperationFailedException cause =
assertIsInstanceOf(HttpOperationFailedException.class, e.getCause());
assertEquals(504, cause.getStatusCode());
- // should be approx 3-4 sec.
- assertTrue(taken < 4500, "Timeout should occur faster than " + taken);
-
MockEndpoint.assertIsSatisfied(context);
Review Comment:
⚠️ **Timing margin concern:** `assertIsSatisfied(context)` uses the default
10-second timeout. The backend async task (`delay=6000`) takes ~6 s, leaving
only ~4 s of margin. Under CI load — the same condition that triggered the
original flakiness — this 4 s window may not be sufficient, reintroducing a
wall-clock dependency.
Use the timed overload with an explicit, generous timeout:
```suggestion
MockEndpoint.assertIsSatisfied(context, 20, TimeUnit.SECONDS);
```
You'll also need to add `import java.util.concurrent.TimeUnit;` at the top
of the file.
--
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]