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

jamesnetherton pushed a commit to branch 3.20.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 57753fc551603829b7883d0e8b86a60fb94a9fe9
Author: JiriOndrusek <[email protected]>
AuthorDate: Tue Apr 29 16:14:14 2025 +0200

    fixes #7317 Longer interval for azureServiceBus.scheduled
---
 .../component/azure/servicebus/it/AzureServiceBusTest.java    | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git 
a/integration-test-groups/azure/azure-servicebus/src/test/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusTest.java
 
b/integration-test-groups/azure/azure-servicebus/src/test/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusTest.java
index 1634c3deb3..6660ebbfc2 100644
--- 
a/integration-test-groups/azure/azure-servicebus/src/test/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusTest.java
+++ 
b/integration-test-groups/azure/azure-servicebus/src/test/java/org/apache/camel/quarkus/component/azure/servicebus/it/AzureServiceBusTest.java
@@ -264,9 +264,9 @@ class AzureServiceBusTest {
                     .then()
                     .statusCode(204);
 
-            // Schedule message for 10 seconds in the future
+            // Schedule message for 15 seconds in the future
             long scheduledEnqueueTime = Instant.now()
-                    .plus(Duration.of(10, ChronoUnit.SECONDS))
+                    .plus(Duration.of(15, ChronoUnit.SECONDS))
                     .toEpochMilli();
 
             RestAssured.given()
@@ -279,7 +279,9 @@ class AzureServiceBusTest {
                     .then()
                     .statusCode(201);
 
-            while (Instant.now().toEpochMilli() < scheduledEnqueueTime) {
+            //we are checking that there is no message in the next 10 seconds.
+            //we should rather avoid checking the message near the scheduled 
time, because process can be delayed and receives the message
+            while (Instant.now().toEpochMilli() < (scheduledEnqueueTime - 
5000)) {
                 // No message should be received before the scheduled time
                 RestAssured.given()
                         .queryParam("endpointUri", 
"mock:servicebus-queue-scheduled-consumer-results")
@@ -288,7 +290,8 @@ class AzureServiceBusTest {
                         .statusCode(200)
                         .body("size()", is(0));
                 try {
-                    Thread.sleep(250);
+                    //wait those 5 seconds, we were not checking
+                    Thread.sleep(5250);
                 } catch (InterruptedException e) {
                     Thread.currentThread().interrupt();
                 }

Reply via email to