-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dynamic_startup_nodes parameter to async RedisCluster
- Loading branch information
Showing
3 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2620,6 +2620,27 @@ def cmd_init_mock(self, r: ClusterNode) -> None: | |
assert rc.get_node(host=default_host, port=7001) is not None | ||
assert rc.get_node(host=default_host, port=7002) is not None | ||
|
||
@pytest.mark.parametrize("dynamic_startup_nodes", [True, False]) | ||
async def test_init_slots_dynamic_startup_nodes(self, dynamic_startup_nodes): | ||
rc = await get_mocked_redis_client( | ||
host="[email protected]", | ||
port=7000, | ||
cluster_slots=default_cluster_slots, | ||
dynamic_startup_nodes=dynamic_startup_nodes, | ||
) | ||
# Nodes are taken from default_cluster_slots | ||
discovered_nodes = [ | ||
"127.0.0.1:7000", | ||
"127.0.0.1:7001", | ||
"127.0.0.1:7002", | ||
"127.0.0.1:7003", | ||
] | ||
startup_nodes = list(rc.nodes_manager.startup_nodes.keys()) | ||
if dynamic_startup_nodes is True: | ||
assert startup_nodes.sort() == discovered_nodes.sort() | ||
else: | ||
assert startup_nodes == ["[email protected]:7000"] | ||
|
||
|
||
class TestClusterPipeline: | ||
"""Tests for the ClusterPipeline class.""" | ||
|