Skip to content

Commit 0d3da4e

Browse files
authored
set default response_callbacks to redis.asyncio.cluster.ClusterNode (#2201)
* set default response_callbacks to redis.asyncio.cluster.ClusterNode * add test case for ClusterNode class * fix lint error * merge test case into `test_startup_nodes`
1 parent 9167a0e commit 0d3da4e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

redis/asyncio/cluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ def __init__(
725725
server_type: Optional[str] = None,
726726
max_connections: int = 2 ** 31,
727727
connection_class: Type[Connection] = Connection,
728-
response_callbacks: Dict = None,
728+
response_callbacks: Dict = RedisCluster.RESPONSE_CALLBACKS,
729729
**connection_kwargs,
730730
) -> None:
731731
if host == "localhost":

tests/test_asyncio/test_cluster.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@ async def test_startup_nodes(self) -> None:
244244

245245
await cluster.close()
246246

247+
startup_nodes = [ClusterNode("127.0.0.1", 16379)]
248+
async with RedisCluster(startup_nodes=startup_nodes) as rc:
249+
assert await rc.set("A", 1)
250+
assert await rc.get("A") == b"1"
251+
247252
async def test_empty_startup_nodes(self) -> None:
248253
"""
249254
Test that exception is raised when empty providing empty startup_nodes

0 commit comments

Comments
 (0)