Skip to content

Latest commit

 

History

History
111 lines (83 loc) · 3.87 KB

File metadata and controls

111 lines (83 loc) · 3.87 KB

Test Results for redis-py 7.x Support

Test Environment

  • redis-py version: 7.1.0
  • Redis servers running:
    • Port 6379 (primary)
    • Port 6380 (secondary)
  • pybreaker: Installed (required for multidb)

Tests Executed

1. Multi-Database (Active-Active) Tests ✅

All multidb tests passed successfully:

✅ test_multidb_available passed
✅ test_multidb_config_creation passed
✅ test_multidb_client_creation passed
✅ test_multidb_from_urls passed
✅ test_multidb_client_initialize passed
✅ test_event_dispatcher_support passed
✅ test_connection_creation_with_event_dispatcher passed

Test file: tests/test_multidb.py

Test Coverage:

  1. MultiDB Availability - Verified multidb support is available with redis-py 7.x
  2. Configuration Creation - Successfully created MultiDbConfig with multiple databases
  3. Client Creation - Created KVDBMultiDBClient from config
  4. from_urls Method - Created client using convenient from_urls() method
  5. Client Initialization - Initialized client and performed basic operations (set/get)
  6. Event Dispatcher Support - Verified event_dispatcher parameter in AsyncAbstractConnection
  7. Connection Pool Creation - Created AsyncConnectionPool without errors

2. Redis-py 7.x Compatibility Tests ✅

Verified compatibility features:

  • EventDispatcher import: Successfully imported with backward compatibility
  • event_dispatcher parameter: Present in AsyncAbstractConnection.init
  • DEPRECATED_SUPPORT flag: Set to False (redis-py >= 7.0 detected)
  • Connection initialization: event_dispatcher initialized when not provided

3. Integration Tests

MultiDB Client Operations ✅

  • Created client with 2 databases (ports 6379 and 6380)
  • Successfully initialized with health checks
  • Performed SET operation
  • Performed GET operation
  • Verified database weights (1.0 and 0.5)
  • Retrieved database list (2 databases)

Connection Pool Tests ✅

  • Created ConnectionPool from URL
  • Created AsyncConnectionPool from URL
  • Both pools initialized without errors

Key Features Validated

1. Event Dispatcher Support

  • ✅ Imported EventDispatcher from redis.asyncio.connection
  • ✅ Added event_dispatcher parameter to AsyncAbstractConnection
  • ✅ Graceful fallback for older redis-py versions
  • ✅ Auto-initialization of event_dispatcher when None

2. Multi-Database Client

  • ✅ KVDBMultiDBClient wrapper created
  • ✅ from_urls() convenience method working
  • ✅ Configuration with DatabaseConfig working
  • ✅ Client initialization with health checks working
  • ✅ Basic Redis operations (set/get) working
  • ✅ Multiple database support verified
  • ✅ MULTIDB_AVAILABLE flag working correctly

3. Backward Compatibility

  • ✅ DEPRECATED_SUPPORT flag for version detection
  • ✅ Graceful handling of missing EventDispatcher
  • ✅ Graceful handling of missing pybreaker

Documentation Verified

  • docs/multidb.md - Comprehensive documentation created
  • examples/multidb_example.py - Working example created
  • README.md - Updated with multidb features

Summary

All redis-py 7.x compatibility tests PASSEDMulti-database (Active-Active) support fully functionalEvent dispatcher parameter properly integratedBackward compatibility maintainedDocumentation complete

Notes

  1. The multidb features require:

    • redis-py >= 7.0
    • pybreaker (for circuit breakers)
  2. The implementation gracefully handles missing dependencies with MULTIDB_AVAILABLE flag

  3. The redis.multidb module shows a UserWarning about being experimental, which is expected behavior from redis-py

  4. All changes maintain backward compatibility with redis-py >= 5.0

Conclusion

The implementation successfully adds redis-py 7.x support with full Active-Active multi-database functionality. All tests pass and the features work as documented.