You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2024/04/30 07:57:32 UTC
(camel) 01/04: (chores) camel-jms: cleanup flaky test
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
commit 16d33ecb03f719f6ab139147499e68b131ae9d47
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Mon Apr 29 10:44:55 2024 +0200
(chores) camel-jms: cleanup flaky test
Prevent running on CI because it spams the logs and uses too many resources
---
...RequestReplyTempQueueMultipleConsumersTest.java | 30 ++++++++++++++--------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyTempQueueMultipleConsumersTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyTempQueueMultipleConsumersTest.java
index bbdc6b4503c..6aecef6ba22 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyTempQueueMultipleConsumersTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyTempQueueMultipleConsumersTest.java
@@ -30,8 +30,9 @@ import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.infra.artemis.services.ArtemisService;
import org.apache.camel.test.infra.artemis.services.ArtemisServiceFactory;
import org.apache.camel.test.junit5.CamelTestSupport;
-import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.api.parallel.Isolated;
import org.junit.jupiter.params.ParameterizedTest;
@@ -46,6 +47,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
* Reliability tests for JMS TempQueue Reply Manager with multiple consumers.
*/
@Isolated("Creates multiple threads")
+@DisabledIfSystemProperty(named = "ci.env.name", matches = ".*",
+ disabledReason = "Multiple problems: requires too much resources and spam logs with Session is closed warnings")
public class JmsRequestReplyTempQueueMultipleConsumersTest extends CamelTestSupport {
@RegisterExtension
@@ -56,10 +59,14 @@ public class JmsRequestReplyTempQueueMultipleConsumersTest extends CamelTestSupp
private ExecutorService executorService;
@Test
- public void testMultipleConsumingThreads() throws Exception {
+ public void testMultipleConsumingThreadsStrict() throws Exception {
+ /*
+ This test is meant to be run locally, on developer machines where
+ the system resources are plentiful.
+ */
executorService = context.getExecutorServiceManager().newFixedThreadPool(this, "test", 5);
- doSendMessages(1000);
+ doSendMessages(1000, 1000);
assertTrue(msgsPerThread.keySet().size() > 1,
"Expected multiple consuming threads, but only found: " + msgsPerThread.keySet().size());
@@ -69,23 +76,26 @@ public class JmsRequestReplyTempQueueMultipleConsumersTest extends CamelTestSupp
@ParameterizedTest
@ValueSource(ints = { 500, 100, 100 })
- @Disabled("This will spam logs with Session is closed")
- public void testTempQueueRefreshed(int numFiles) throws Exception {
+ public void testTempQueueRefreshed(int numSend) throws Exception {
executorService = context.getExecutorServiceManager().newFixedThreadPool(this, "test", 5);
- doSendMessages(numFiles);
- connectionFactory.clear();
+ doSendMessages(numSend, numSend);
context.getExecutorServiceManager().shutdown(executorService);
}
- private void doSendMessages(int files) throws Exception {
+ @AfterEach
+ public void clearConnection() {
+ connectionFactory.clear();
+ }
+
+ private void doSendMessages(int numSend, int numExpect) throws Exception {
MockEndpoint.resetMocks(context);
MockEndpoint mockEndpoint = getMockEndpoint("mock:result");
- mockEndpoint.expectedMessageCount(files);
+ mockEndpoint.expectedMessageCount(numExpect);
mockEndpoint.expectsNoDuplicates(body());
- for (int i = 0; i < files; i++) {
+ for (int i = 0; i < numSend; i++) {
final int index = i;
executorService.submit(() -> {
template.sendBody("direct:start", "Message " + index);