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

orpiske 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 1eb5e04f0e4 (chores) camel-jpa: enforce a timeout for some 
thread-unsafe tests
1eb5e04f0e4 is described below

commit 1eb5e04f0e4133da40e8ac0013fe66b4625b80af
Author: Otavio Rodolfo Piske <angusyo...@gmail.com>
AuthorDate: Wed Jan 15 13:57:05 2025 +0100

    (chores) camel-jpa: enforce a timeout for some thread-unsafe tests
    
    Sometimes these tests hang indefinitely
---
 .../java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java    | 4 +++-
 .../java/org/apache/camel/component/jpa/JpaWithNativeQueryTest.java   | 2 ++
 .../test/java/org/apache/camel/component/jpa/JpaWithQueryTest.java    | 2 ++
 .../java/org/apache/camel/processor/jpa/JpaProducerWithQueryTest.java | 2 ++
 4 files changed, 9 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
 
b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
index f95ce399a72..b9f256243fa 100644
--- 
a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
+++ 
b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
@@ -34,6 +34,7 @@ import org.apache.camel.support.service.ServiceHelper;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.transaction.TransactionStatus;
@@ -44,6 +45,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
+@Timeout(30)
 public class JpaWithNamedQueryTest {
 
     protected static final Logger LOG = 
LoggerFactory.getLogger(JpaWithNamedQueryTest.class);
@@ -102,7 +104,7 @@ public class JpaWithNamedQueryTest {
         });
         consumer.start();
 
-        assertTrue(latch.await(50, TimeUnit.SECONDS));
+        assertTrue(latch.await(10, TimeUnit.SECONDS));
 
         assertReceivedResult(receivedExchange);
 
diff --git 
a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNativeQueryTest.java
 
b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNativeQueryTest.java
index dd55973c0c3..f8891583492 100644
--- 
a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNativeQueryTest.java
+++ 
b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNativeQueryTest.java
@@ -18,11 +18,13 @@ package org.apache.camel.component.jpa;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.examples.MultiSteps;
+import org.junit.jupiter.api.Timeout;
 import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 
+@Timeout(30)
 @DisabledIfSystemProperty(named = "ci.env.name", matches = "apache.org",
                           disabledReason = "Apache CI is hanging on this test")
 public class JpaWithNativeQueryTest extends JpaWithNamedQueryTest {
diff --git 
a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithQueryTest.java
 
b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithQueryTest.java
index 31247359e12..1304c160a30 100644
--- 
a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithQueryTest.java
+++ 
b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithQueryTest.java
@@ -17,10 +17,12 @@
 package org.apache.camel.component.jpa;
 
 import org.apache.camel.examples.MultiSteps;
+import org.junit.jupiter.api.Timeout;
 import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
+@Timeout(30)
 @DisabledIfSystemProperty(named = "ci.env.name", matches = "apache.org",
                           disabledReason = "Apache CI is hanging on this test")
 public class JpaWithQueryTest extends JpaWithNamedQueryTest {
diff --git 
a/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaProducerWithQueryTest.java
 
b/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaProducerWithQueryTest.java
index 7a10fb243b9..f4da5631f6d 100644
--- 
a/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaProducerWithQueryTest.java
+++ 
b/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaProducerWithQueryTest.java
@@ -29,9 +29,11 @@ import org.apache.camel.support.SimpleRegistry;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
+@Timeout(30)
 public class JpaProducerWithQueryTest {
 
     protected DefaultCamelContext camelContext;

Reply via email to