diff --git a/debezium-server-redis/src/test/java/io/debezium/server/redis/TestUtils.java b/debezium-server-redis/src/test/java/io/debezium/server/redis/TestUtils.java index aec9a6d1..943df4af 100644 --- a/debezium-server-redis/src/test/java/io/debezium/server/redis/TestUtils.java +++ b/debezium-server-redis/src/test/java/io/debezium/server/redis/TestUtils.java @@ -16,6 +16,7 @@ import io.debezium.testing.testcontainers.PostgresTestResourceLifecycleManager; import redis.clients.jedis.Jedis; +import redis.clients.jedis.exceptions.JedisConnectionException; public class TestUtils { @@ -37,7 +38,14 @@ public static void awaitStreamLengthGte(Jedis jedis, String streamName, int expe } public static void awaitHashSizeGte(Jedis jedis, String hashName, int expectedSize) { - waitBoolean(() -> jedis.hgetAll(hashName).size() >= expectedSize); + waitBoolean(() -> { + try { + return jedis.hgetAll(hashName).size() >= expectedSize; + } + catch (JedisConnectionException e) { + return false; + } + }); } public static void waitBoolean(Supplier bool) {