Skip to content

Commit 896de29

Browse files
AA scenario tests (#3659)
* Add Active-Active failover scenario tests for automatic-failover feature Introduces 4 scenario tests to verify the automatic-failover feature against a real Redis Enterprise Active-Active deployment: 1. testHealthCheckFailoverWithFailback - Tests complete failover/failback cycle using controllable health check strategy 2. testHealthCheckFailover - Tests health check triggered failover 3. testManualSwitch - Tests manual endpoint switching with workload 4. testPubSubFailover - Tests Pub/Sub subscriptions survive failover Key verification points: - Commands route to correct endpoint (verified via run_id) - No stuck commands during failover - Proper SwitchReason events (HEALTH_CHECK, FAILBACK, FORCED) - Grace period and failback support work correctly * feat(test): add circuit breaker failover test with network latency Add testCircuitBreakerFailover test that verifies the circuit breaker correctly triggers failover when commands timeout due to network latency. The test: - Configures client with 500ms command timeout - Injects 2000ms network latency on primary endpoint via fault injector - Fires commands that timeout with RedisCommandTimeoutException - Verifies circuit breaker detects failures and triggers failover - Confirms SwitchReason is CIRCUIT_BREAKER - Validates commands work on secondary endpoint after failover This test requires the network_latency action in the fault injector which uses tc netem to add latency on the Redis Enterprise node. * feat(test): add failback and data integrity AA tests Add two new scenario tests for Active-Active failover: - testHealthCheckFailoverWithFailback: Tests complete failover/failback cycle using controllable health check strategy. Verifies HEALTH_CHECK triggered failover, then FAILBACK when primary becomes healthy again. - testDataIntegrityDuringFailover: Verifies AA replication works during failover. Writes 100 keys on primary, fails over to secondary, verifies all keys replicated, writes 50 more on secondary, fails back to primary, verifies bidirectional replication. Also adds waitForClusterHealthy() teardown method to ensure cluster recovers from network latency injection before next test runs. This mirrors the redis-py approach of probing PING latency until cluster is responsive (streak of 3 fast PINGs). * refactor(test): clean up AA failover tests - Extract magic numbers to named constants - Remove code duplication with helper methods - Replace Thread.sleep with Awaitility where possible - Remove excessive comments and javadoc - Reduce file from ~1164 to ~870 lines
1 parent b4efbf7 commit 896de29

1 file changed

Lines changed: 869 additions & 0 deletions

File tree

0 commit comments

Comments
 (0)