| import sys | |
| from pathlib import Path | |
| # Add project root to path | |
| project_root = Path(__file__).parent | |
| sys.path.append(str(project_root)) | |
| from core.redis_client import redis_client | |
| def test_hardcoded_connection(): | |
| """Test Redis connection with new non-SSL configuration""" | |
| print("Testing Redis connection with non-SSL configuration...") | |
| # Test the actual client being used | |
| print("\nTesting application Redis client...") | |
| client = redis_client.get_client() | |
| if client is None: | |
| print("β Application Redis client is None") | |
| return 1 | |
| try: | |
| client.ping() | |
| print("β Application Redis client ping successful") | |
| # Test set/get operations | |
| client.set('non_ssl_test_key', 'non_ssl_test_value') | |
| value = client.get('non_ssl_test_key') | |
| client.delete('non_ssl_test_key') # Cleanup | |
| if value == 'non_ssl_test_value': | |
| print("β Set/Get operations work correctly") | |
| print("\nπ Non-SSL Redis connection test passed!") | |
| return 0 | |
| else: | |
| print("β Set/Get operations failed") | |
| return 1 | |
| except Exception as e: | |
| print(f"β Application Redis client test failed: {e}") | |
| return 1 | |
| if __name__ == "__main__": | |
| exit_code = test_hardcoded_connection() | |
| sys.exit(exit_code) | |