Skip to content

Raising NotImplementedError for certain CLUSTER commands #2504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions redis/commands/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,16 @@ def cluster_links(self, target_node: "TargetNodesT") -> ResponseT:
"""
return self.execute_command("CLUSTER LINKS", target_nodes=target_node)

def cluster_flushslots(self, target_nodes: Optional["TargetNodesT"] = None) -> None:
raise NotImplementedError(
"CLUSTER FLUSHSLOTS is intentionally not implemented in the client."
)

def cluster_bumpepoch(self, target_nodes: Optional["TargetNodesT"] = None) -> None:
raise NotImplementedError(
"CLUSTER BUMPEPOCH is intentionally not implemented in the client."
)

def readonly(self, target_nodes: Optional["TargetNodesT"] = None) -> ResponseT:
"""
Enables read queries.
Expand Down
8 changes: 8 additions & 0 deletions tests/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,14 @@ def test_cluster_links(self, r):
for i in range(0, len(res) - 1, 2):
assert res[i][3] == res[i + 1][3]

def test_cluster_flshslots_not_implemented(self, r):
with pytest.raises(NotImplementedError):
r.cluster_flushslots()

def test_cluster_bumpepoch_not_implemented(self, r):
with pytest.raises(NotImplementedError):
r.cluster_bumpepoch()

@skip_if_redis_enterprise()
def test_readonly(self):
r = get_mocked_redis_client(host=default_host, port=default_port)
Expand Down