This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new a1ce747df5cc CAMEL-27553: camel-quartz - fix flaky 
FileConsumerQuartzSchedulerStartSchedulerTest (#31018)
a1ce747df5cc is described below

commit a1ce747df5ccbe3ca975a3b5b4aa1eb34407c565
Author: AurĂ©lien Pupier <[email protected]>
AuthorDate: Fri Nov 27 16:22:39 2026 +0100

    CAMEL-27553: camel-quartz - fix flaky 
FileConsumerQuartzSchedulerStartSchedulerTest (#31018)
    
    testStartSchedulerFalseMustNotPoll checked that no message is received with
    await().during(3, SECONDS).atMost(4, SECONDS). The 'during' period must be
    fully elapsed within the 'atMost' timeout, leaving only one second of slack
    for everything else. On a loaded CI machine, a delay of about a second or
    more before or during the first evaluation of the condition makes Awaitility
    fail with a ConditionTimeoutException, even though nothing was polled.
    This was reproduced locally by adding a 1.5 second delay to the first
    evaluation of the original condition.
    
    Use MockEndpoint.setAssertPeriod(3000) with assertIsSatisfied() instead: the
    mock asserts that no message was received, waits 3 seconds (longer than the
    2 second cron interval) and asserts again. There is no outer timeout that 
can
    expire any more.
    
    Co-authored-by: IBM Bob 2.2.1
    Signed-off-by: AurĂ©lien Pupier <[email protected]>
---
 .../FileConsumerQuartzSchedulerStartSchedulerTest.java       | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/components/camel-quartz/src/test/java/org/apache/camel/pollconsumer/quartz/FileConsumerQuartzSchedulerStartSchedulerTest.java
 
b/components/camel-quartz/src/test/java/org/apache/camel/pollconsumer/quartz/FileConsumerQuartzSchedulerStartSchedulerTest.java
index b70689d1b328..a4ccc11493f1 100644
--- 
a/components/camel-quartz/src/test/java/org/apache/camel/pollconsumer/quartz/FileConsumerQuartzSchedulerStartSchedulerTest.java
+++ 
b/components/camel-quartz/src/test/java/org/apache/camel/pollconsumer/quartz/FileConsumerQuartzSchedulerStartSchedulerTest.java
@@ -17,17 +17,15 @@
 package org.apache.camel.pollconsumer.quartz;
 
 import java.nio.file.Path;
-import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit6.CamelTestSupport;
 import org.apache.camel.test.junit6.TestSupport;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.io.TempDir;
 
-import static org.awaitility.Awaitility.await;
-
 public class FileConsumerQuartzSchedulerStartSchedulerTest extends 
CamelTestSupport {
     @TempDir
     Path testDirectory;
@@ -36,11 +34,13 @@ public class FileConsumerQuartzSchedulerStartSchedulerTest 
extends CamelTestSupp
     public void testStartSchedulerFalseMustNotPoll() throws Exception {
         template.sendBodyAndHeader(TestSupport.fileUri(testDirectory), "Hello 
World", Exchange.FILE_NAME, "hello.txt");
 
-        getMockEndpoint("mock:result").expectedMessageCount(0);
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(0);
+        // the cron fires every 2 seconds, so wait longer than that and verify 
still no message was received
+        mock.setAssertPeriod(3000);
 
         // startScheduler=false should prevent polling even with 
scheduler=quartz
-        await().during(3, TimeUnit.SECONDS).atMost(4, TimeUnit.SECONDS)
-                .untilAsserted(() -> 
getMockEndpoint("mock:result").assertIsSatisfied());
+        mock.assertIsSatisfied();
     }
 
     @Override

Reply via email to