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

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

commit 8af02148ec2d635ca34af5034c81024e2af27642
Author: MikoĊ‚aj Diakowski <[email protected]>
AuthorDate: Thu Dec 11 09:32:06 2025 +0100

    CAMEL-22109: Fix flaky test MinaUdpNoCamelTest.testMinaUDPWithNoCamel
    
    The test was failing on some environments (e.g. s390x) because of UDP 
packet loss or timing issues.
    
    Relaxed the assertion to expect at least 200 messages instead of exactly 
222, acknowledging the unreliable nature of UDP.
    
    Added a small delay (5ms) between sending messages to reduce the chance of 
buffer overflow and packet loss.
---
 .../java/org/apache/camel/component/mina/MinaUdpNoCamelTest.java   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaUdpNoCamelTest.java
 
b/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaUdpNoCamelTest.java
index 67730cc4c818..da8684a95edb 100644
--- 
a/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaUdpNoCamelTest.java
+++ 
b/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaUdpNoCamelTest.java
@@ -43,6 +43,7 @@ import org.slf4j.LoggerFactory;
 
 import static org.awaitility.Awaitility.await;
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class MinaUdpNoCamelTest {
 
@@ -66,15 +67,17 @@ public class MinaUdpNoCamelTest {
     }
 
     @Test
-    public void testMinaUDPWithNoCamel() {
+    public void testMinaUDPWithNoCamel() throws InterruptedException {
         UDPClient client = new UDPClient();
         client.connect("127.0.0.1", port);
         for (int i = 0; i < 222; i++) {
             client.sendNoMina("Hello Mina " + i + System.lineSeparator());
+            Thread.sleep(5);
         }
 
         await().atMost(5, TimeUnit.SECONDS)
-                .untilAsserted(() -> assertEquals(222, 
server.numMessagesReceived));
+                .untilAsserted(() -> assertTrue(server.numMessagesReceived >= 
200,
+                        "Expected at least 200 messages, but received " + 
server.numMessagesReceived));
     }
 
     /*

Reply via email to