Skip to content

Commit bd5570a

Browse files
majiayu000claude
andcommitted
Add tests for ssl_ca_path and add to REDIS_ALLOWED_KEYS
- Add test_ssl_ca_path_parameter test to verify ssl_ca_path is properly passed through to SSLConnection - Add ssl_ca_path to REDIS_ALLOWED_KEYS tuple in cluster.py for sync cluster client support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 7466484 commit bd5570a

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

redis/cluster.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ def parse_cluster_myshardid(resp, **options):
185185
"ssl",
186186
"ssl_ca_certs",
187187
"ssl_ca_data",
188+
"ssl_ca_path",
188189
"ssl_certfile",
189190
"ssl_cert_reqs",
190191
"ssl_include_verify_flags",

tests/test_asyncio/test_ssl.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,29 @@ def capture_context_create_default():
141141

142142
finally:
143143
await r.aclose()
144+
145+
async def test_ssl_ca_path_parameter(self, request):
146+
"""Test that ssl_ca_path parameter is properly passed to SSLConnection"""
147+
ssl_url = request.config.option.redis_ssl_url
148+
parsed_url = urlparse(ssl_url)
149+
150+
# Test with a mock ca_path directory
151+
test_ca_path = "/tmp/test_ca_certs"
152+
153+
r = redis.Redis(
154+
host=parsed_url.hostname,
155+
port=parsed_url.port,
156+
ssl=True,
157+
ssl_cert_reqs="none",
158+
ssl_ca_path=test_ca_path,
159+
)
160+
161+
try:
162+
# Get the connection to verify ssl_ca_path is passed through
163+
conn = r.connection_pool.make_connection()
164+
assert isinstance(conn, redis.SSLConnection)
165+
166+
# Verify the ca_path is stored in the SSL context
167+
assert conn.ssl_context.ca_path == test_ca_path
168+
finally:
169+
await r.aclose()

0 commit comments

Comments
 (0)