Skip to content

Commit

Permalink
DBZ-7564 Wait for Redis server to start
Browse files Browse the repository at this point in the history
  • Loading branch information
vjuranek committed Feb 26, 2024
1 parent 54bb573 commit 3184434
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import io.debezium.testing.testcontainers.PostgresTestResourceLifecycleManager;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.exceptions.JedisConnectionException;

public class TestUtils {

Expand All @@ -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<Boolean> bool) {
Expand Down

0 comments on commit 3184434

Please sign in to comment.