Package io.debezium.server.redis
Class RedisStreamIT
- java.lang.Object
-
- io.debezium.server.redis.RedisStreamIT
-
@QuarkusTestResource(io.debezium.testing.testcontainers.PostgresTestResourceLifecycleManager.class) @QuarkusTestResource(RedisTestResourceLifecycleManager.class) public class RedisStreamIT extends Object
Integration tests that verify basic reading from PostgreSQL database and writing to Redis stream and retry mechanism in case of connectivity issues or OOM in Redis- Author:
- M Sazzadul Hoque
-
-
Constructor Summary
Constructors Constructor Description RedisStreamIT()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidconnectorCompleted(io.debezium.server.events.ConnectorCompletedEvent event)private PostgresConnectiongetPostgresConnection()private LonggetStreamLength(String streamName, int expectedLength)(package private) voidsetupDependencies(io.debezium.server.events.ConnectorStartedEvent event)voidtestRedisConnectionRetry()Test retry mechanism when encountering Redis connectivity issues: 1.voidtestRedisOOMRetry()Test retry mechanism when encountering Redis Out of Memory: 1.voidtestRedisStream()Verifies that all the records of a PostgreSQL table are streamed to Redis
-
-
-
Method Detail
-
setupDependencies
void setupDependencies(@Observes io.debezium.server.events.ConnectorStartedEvent event)
-
connectorCompleted
void connectorCompleted(@Observes io.debezium.server.events.ConnectorCompletedEvent event) throws Exception- Throws:
Exception
-
getPostgresConnection
private PostgresConnection getPostgresConnection()
-
testRedisStream
@Test public void testRedisStream() throws ExceptionVerifies that all the records of a PostgreSQL table are streamed to Redis- Throws:
Exception
-
testRedisConnectionRetry
@Test @FixFor("DBZ-4510") public void testRedisConnectionRetry() throws ExceptionTest retry mechanism when encountering Redis connectivity issues: 1. Make Redis to be unavailable while the server is up 2. Create a new table named redis_test in PostgreSQL and insert 5 records to it 3. Bring Redis up again and make sure these records have been streamed successfully- Throws:
Exception
-
testRedisOOMRetry
@Test @FixFor("DBZ-4510") public void testRedisOOMRetry() throws ExceptionTest retry mechanism when encountering Redis Out of Memory: 1. Simulate a Redis OOM by setting its max memory to 1M 2. Create a new table named redis_test2 in PostgreSQL and insert 10 records to it 3. Then, delete all the records in this table and expect the stream to contain 30 records (10 inserted before + 20 as result of this deletion including the tombstone events) 4. Insert 22 records to redis_test2 table and sleep for 1 second to simulate Redis OOM 5. Delete the stream and expect those 22 records to be inserted to it as there's enough memory to complete this operation- Throws:
Exception
-
-