diff --git a/pom.xml b/pom.xml
index 316a98f66..688d8ef90 100644
--- a/pom.xml
+++ b/pom.xml
@@ -266,7 +266,7 @@
org.signal
embedded-redis
- 0.9.0
+ 0.9.1
test
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/redis/RedisServerExtension.java b/service/src/test/java/org/whispersystems/textsecuregcm/redis/RedisServerExtension.java
index a4c84a00f..851fe11b5 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/redis/RedisServerExtension.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/redis/RedisServerExtension.java
@@ -20,6 +20,7 @@ import org.junit.jupiter.api.extension.ExtensionContext;
import org.whispersystems.textsecuregcm.configuration.CircuitBreakerConfiguration;
import org.whispersystems.textsecuregcm.configuration.RetryConfiguration;
import redis.embedded.RedisServer;
+import redis.embedded.exceptions.EmbeddedRedisException;
public class RedisServerExtension implements BeforeAllCallback, BeforeEachCallback, AfterAllCallback, AfterEachCallback {
@@ -52,7 +53,7 @@ public class RedisServerExtension implements BeforeAllCallback, BeforeEachCallba
.port(getAvailablePort())
.build();
- redisServer.start();
+ startWithRetries(3);
}
public static RedisURI getRedisURI() {
@@ -96,4 +97,16 @@ public class RedisServerExtension implements BeforeAllCallback, BeforeEachCallba
return socket.getLocalPort();
}
}
+
+ private void startWithRetries(int attemptsLeft) throws Exception {
+ try {
+ redisServer.start();
+ } catch (final EmbeddedRedisException e) {
+ if (attemptsLeft == 0) {
+ throw e;
+ }
+ Thread.sleep(500);
+ startWithRetries(attemptsLeft - 1);
+ }
+ }
}