You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2020/04/17 00:32:23 UTC

[james-project] 31/39: JAMES-3139 Speed up integration tests for Distributed James

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

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 10cbd3ea1e12b81789f9f1bdf6066b5c5ded4fea
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu Apr 16 09:51:58 2020 +0700

    JAMES-3139 Speed up integration tests for Distributed James
    
    Decrease wait delays, timeouts, and retry count to fasten our integration
    tests
    
    This is a generalisation of a cryptic optimization performed for
    RabbitMQEventDeadLettersIntegrationTest
---
 .../java/org/apache/james/modules/TestRabbitMQModule.java  | 14 ++++++++++++++
 .../rabbitmq/RabbitMQEventDeadLettersIntegrationTest.java  | 12 +-----------
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/TestRabbitMQModule.java b/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/TestRabbitMQModule.java
index 35438ac..47012aa 100644
--- a/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/TestRabbitMQModule.java
+++ b/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/TestRabbitMQModule.java
@@ -39,6 +39,13 @@ import com.google.inject.Provides;
 import com.google.inject.multibindings.Multibinder;
 
 public class TestRabbitMQModule extends AbstractModule {
+    private static final int MAX_THREE_RETRIES = 3;
+    private static final int MIN_DELAY_OF_ONE_HUNDRED_MILLISECONDS = 100;
+    private static final int CONNECTION_TIMEOUT_OF_ONE_SECOND = 1000;
+    private static final int CHANNEL_RPC_TIMEOUT_OF_ONE_SECOND = 1000;
+    private static final int HANDSHAKE_TIMEOUT_OF_ONE_SECOND = 1000;
+    private static final int SHUTDOWN_TIMEOUT_OF_ONE_SECOND = 1000;
+    private static final int NETWORK_RECOVERY_INTERVAL_OF_ONE_SECOND = 1000;
 
     private final DockerRabbitMQ rabbitMQ;
 
@@ -67,6 +74,13 @@ public class TestRabbitMQModule extends AbstractModule {
             .amqpUri(rabbitMQ.amqpUri())
             .managementUri(rabbitMQ.managementUri())
             .managementCredentials(DEFAULT_MANAGEMENT_CREDENTIAL)
+            .maxRetries(MAX_THREE_RETRIES)
+            .minDelayInMs(MIN_DELAY_OF_ONE_HUNDRED_MILLISECONDS)
+            .connectionTimeoutInMs(CONNECTION_TIMEOUT_OF_ONE_SECOND)
+            .channelRpcTimeoutInMs(CHANNEL_RPC_TIMEOUT_OF_ONE_SECOND)
+            .handshakeTimeoutInMs(HANDSHAKE_TIMEOUT_OF_ONE_SECOND)
+            .shutdownTimeoutInMs(SHUTDOWN_TIMEOUT_OF_ONE_SECOND)
+            .networkRecoveryIntervalInMs(NETWORK_RECOVERY_INTERVAL_OF_ONE_SECOND)
             .build();
     }
 
diff --git a/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQEventDeadLettersIntegrationTest.java b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQEventDeadLettersIntegrationTest.java
index 58f4772..b8cbbd0 100644
--- a/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQEventDeadLettersIntegrationTest.java
+++ b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQEventDeadLettersIntegrationTest.java
@@ -29,7 +29,6 @@ import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.Matchers.containsInAnyOrder;
 import static org.hamcrest.Matchers.hasSize;
 
-import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -45,7 +44,6 @@ import org.apache.james.GuiceModuleTestExtension;
 import org.apache.james.JamesServerBuilder;
 import org.apache.james.JamesServerExtension;
 import org.apache.james.backends.rabbitmq.DockerRabbitMQ;
-import org.apache.james.backends.rabbitmq.RabbitMQConnectionFactory;
 import org.apache.james.core.Username;
 import org.apache.james.junit.categories.BasicFeature;
 import org.apache.james.mailbox.DefaultMailboxes;
@@ -203,15 +201,7 @@ class RabbitMQEventDeadLettersIntegrationTest {
         .extension(new RetryEventsListenerExtension())
         .server(configuration -> GuiceJamesServer.forConfiguration(configuration)
             .combineWith(CassandraRabbitMQJamesServerMain.MODULES)
-            .overrideWith(new WebadminIntegrationTestModule())
-            .overrideWith(binder -> {
-                try {
-                    binder.bind(RabbitMQConnectionFactory.class)
-                        .toInstance(RABBIT_MQ_EXTENSION.dockerRabbitMQ().createRabbitConnectionFactory());
-                } catch (URISyntaxException e) {
-                    throw new RuntimeException(e);
-                }
-            }))
+            .overrideWith(new WebadminIntegrationTestModule()))
         .build();
 
     //This value is duplicated from default configuration to ensure we keep the same behavior over time


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org