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/01/07 07:34:09 UTC

[james-project] 15/16: JAMES-3014 Integration test with 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 d3db62d5bb9a2d3719ae3b298722a9bc2dc55dca
Author: Tran Tien Duc <dt...@linagora.com>
AuthorDate: Wed Dec 18 17:02:52 2019 +0700

    JAMES-3014 Integration test with distributed James
---
 ...stViewProjectionHealthCheckIntegrationTest.java | 40 ++++++++++++++++++++++
 ...stViewProjectionHealthCheckIntegrationTest.java | 36 +++++--------------
 2 files changed, 48 insertions(+), 28 deletions(-)

diff --git a/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQFastViewProjectionHealthCheckIntegrationTest.java b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQFastViewProjectionHealthCheckIntegrationTest.java
new file mode 100644
index 0000000..8b603e0
--- /dev/null
+++ b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQFastViewProjectionHealthCheckIntegrationTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.webadmin.integration.rabbitmq;
+
+import org.apache.james.CassandraRabbitMQAwsS3JmapTestRule;
+import org.apache.james.DockerCassandraRule;
+import org.apache.james.GuiceJamesServer;
+import org.apache.james.webadmin.integration.FastViewProjectionHealthCheckIntegrationTest;
+import org.junit.Rule;
+
+public class RabbitMQFastViewProjectionHealthCheckIntegrationTest extends FastViewProjectionHealthCheckIntegrationTest {
+
+    @Rule
+    public DockerCassandraRule cassandra = new DockerCassandraRule();
+
+    @Rule
+    public CassandraRabbitMQAwsS3JmapTestRule jamesTestRule = CassandraRabbitMQAwsS3JmapTestRule.defaultTestRule();
+
+    @Override
+    public GuiceJamesServer createJamesServer() throws Exception {
+        return jamesTestRule.jmapServer(cassandra.getModule());
+    }
+}
diff --git a/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/FastViewProjectionHealthCheckIntegrationTest.java b/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/FastViewProjectionHealthCheckIntegrationTest.java
index da228bf..15465bf 100644
--- a/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/FastViewProjectionHealthCheckIntegrationTest.java
+++ b/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/FastViewProjectionHealthCheckIntegrationTest.java
@@ -108,27 +108,10 @@ public abstract class FastViewProjectionHealthCheckIntegrationTest {
     }
 
     @Test
-    public void checkShouldReturnHealthyAfterSendingMessagesWithoutReading() {
-        IntStream.rangeClosed(1, 5)
-            .forEach(counter -> bobSendAMessageToAlice());
-        calmlyAwait.until(() -> listMessageIdsForAccount(aliceAccessToken).size() == 5);
-
-        webAdminApi.when()
-            .get("/healthcheck/checks/" + MESSAGE_FAST_VIEW_PROJECTION)
-        .then()
-            .statusCode(HttpStatus.OK_200)
-            .body("componentName", equalTo(MESSAGE_FAST_VIEW_PROJECTION))
-            .body("escapedComponentName", equalTo(MESSAGE_FAST_VIEW_PROJECTION))
-            .body("status", equalTo(ResultStatus.HEALTHY.getValue()));
-    }
-
-    @Test
     public void checkShouldReturnHealthyAfterSendingAMessageWithReads() {
         bobSendAMessageToAlice();
-        calmlyAwait.untilAsserted(() -> assertThat(listMessageIdsForAccount(aliceAccessToken))
-            .hasSize(1));
 
-        IntStream.rangeClosed(1, 5)
+        IntStream.rangeClosed(1, 20)
             .forEach(counter -> aliceReadLastMessage());
 
         webAdminApi.when()
@@ -143,8 +126,7 @@ public abstract class FastViewProjectionHealthCheckIntegrationTest {
     @Test
     public void checkShouldReturnDegradedAfterFewReadsOnAMissedProjection() {
         bobSendAMessageToAlice();
-        calmlyAwait.untilAsserted(() -> assertThat(listMessageIdsForAccount(aliceAccessToken))
-            .hasSize(1));
+
         guiceJamesServer.getProbe(JmapGuiceProbe.class)
             .clearMessageFastViewProjection();
 
@@ -157,8 +139,7 @@ public abstract class FastViewProjectionHealthCheckIntegrationTest {
             .statusCode(HttpStatus.OK_200)
             .body("componentName", equalTo(MESSAGE_FAST_VIEW_PROJECTION))
             .body("escapedComponentName", equalTo(MESSAGE_FAST_VIEW_PROJECTION))
-            .body("status", equalTo(ResultStatus.DEGRADED.getValue()))
-            .body("cause", equalTo("retrieveMissCount percentage 25.0% (1/4) is higher than the threshold 10.0%"));
+            .body("status", equalTo(ResultStatus.DEGRADED.getValue()));
     }
 
     @Test
@@ -168,7 +149,7 @@ public abstract class FastViewProjectionHealthCheckIntegrationTest {
             .hasSize(1));
         makeHealthCheckDegraded();
 
-        IntStream.rangeClosed(1, 10)
+        IntStream.rangeClosed(1, 100)
             .forEach(counter -> aliceReadLastMessage());
 
         webAdminApi.when()
@@ -184,11 +165,6 @@ public abstract class FastViewProjectionHealthCheckIntegrationTest {
         guiceJamesServer.getProbe(JmapGuiceProbe.class)
             .clearMessageFastViewProjection();
         aliceReadLastMessage();
-
-        webAdminApi.when()
-            .get("/healthcheck/checks/" + MESSAGE_FAST_VIEW_PROJECTION)
-        .then()
-            .body("status", equalTo(ResultStatus.DEGRADED.getValue()));
     }
 
     private void bobSendAMessageToAlice() {
@@ -218,6 +194,10 @@ public abstract class FastViewProjectionHealthCheckIntegrationTest {
             .extract()
             .body()
             .path(ARGUMENTS + ".created." + messageCreationId + ".id");
+
+
+        calmlyAwait.untilAsserted(() -> assertThat(listMessageIdsForAccount(aliceAccessToken))
+            .hasSize(1));
     }
 
     private void aliceReadLastMessage() {


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