-
Notifications
You must be signed in to change notification settings - Fork 171
Add Sentinel mode unit tests for Valkey client reconnection #10772
Copy link
Copy link
Open
Description
Objective
Add unit tests verifying Valkey client behavior in Sentinel mode, covering master failover detection and reconnection scenarios that are not testable with a standalone Redis instance.
Background
Currently, all Valkey client tests use a standalone Redis container. There are no tests for Sentinel-specific behavior such as master address change detection (need_reconnect), Sentinel discovery failure handling, or reconnection after master failover. BA-5577 requires verification in both Standalone and Sentinel modes.
Scope
Mock-based unit tests
- ValkeySentinelClient.need_reconnect() detects master address change
- ValkeySentinelClient._get_master_address() handles Sentinel discovery failure
- MonitoringValkeyClient monitor loop triggers reconnect on master change (via mocked Sentinel)
- acquire() failure tracking and reconnect with Sentinel client (via mocked Sentinel)
Mock targets
- Sentinel.discover_master() — control master address returns
- GlideClient.create() — return mock client without real connection
Future consideration
Integration tests with real Sentinel infrastructure (Docker Compose with master + replica + sentinel) would require CI infrastructure changes and are out of scope for this issue.
Acceptance Criteria
- Unit tests for ValkeySentinelClient Sentinel-specific behavior (need_reconnect, master discovery failure)
- Unit tests for MonitoringValkeyClient wrapping a Sentinel client (monitor loop + acquire reconnect)
- All tests pass in CI
JIRA Issue: BA-5585
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels