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 fcfabe005edf07f1acc57f6fc594ccc2a68f5d2b Author: Rene Cordier <rcord...@linagora.com> AuthorDate: Thu Apr 3 10:37:17 2025 +0700 [JAMES-3693] Add a test for failover recovery with redis sentinel health check --- .../redis/RedisSentinelHealthCheckTest.scala | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisSentinelHealthCheckTest.scala b/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisSentinelHealthCheckTest.scala index 9f1b03d028..9a4e373228 100644 --- a/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisSentinelHealthCheckTest.scala +++ b/backends-common/redis/src/test/java/org/apache/james/backends/redis/RedisSentinelHealthCheckTest.scala @@ -19,10 +19,15 @@ package org.apache.james.backends.redis +import java.util.concurrent.TimeUnit + import org.apache.james.backends.redis.RedisSentinelExtension.RedisSentinelCluster import org.apache.james.server.core.filesystem.FileSystemImpl +import org.assertj.core.api.Assertions.assertThat +import org.awaitility.Awaitility import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.{AfterEach, BeforeEach} +import org.junit.jupiter.api.{AfterEach, BeforeEach, Test} +import reactor.core.publisher.Mono @ExtendWith(Array(classOf[RedisSentinelExtension])) class RedisSentinelHealthCheckTest extends RedisHealthCheckTest { @@ -52,4 +57,19 @@ class RedisSentinelHealthCheckTest extends RedisHealthCheckTest { def unpauseRedis(): Unit = { redisSentinelCluster.redisMasterReplicaContainerList.unPauseMasterNode() } + + @Test + def checkShouldReturnHealthyAfterRedisSentinelFailoverRecovery(): Unit = { + pauseRedis() + + Awaitility.await + .pollInterval(2, TimeUnit.SECONDS) + .atMost(20, TimeUnit.SECONDS) + .untilAsserted(() => assertThat(Mono.from(getRedisHealthCheck.check).block.isDegraded).isTrue) + + Awaitility.await + .pollInterval(2, TimeUnit.SECONDS) + .atMost(30, TimeUnit.SECONDS) + .untilAsserted(() => assertThat(Mono.from(getRedisHealthCheck.check).block.isHealthy).isTrue) + } } --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org