Skip to content

Commit 022a3e8

Browse files
dvora-hchayim
andauthored
Raising NotImplementedError for certain CLUSTER commands (#2504)
Co-authored-by: Chayim <[email protected]>
1 parent b556440 commit 022a3e8

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

redis/commands/cluster.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,16 @@ def cluster_links(self, target_node: "TargetNodesT") -> ResponseT:
644644
"""
645645
return self.execute_command("CLUSTER LINKS", target_nodes=target_node)
646646

647+
def cluster_flushslots(self, target_nodes: Optional["TargetNodesT"] = None) -> None:
648+
raise NotImplementedError(
649+
"CLUSTER FLUSHSLOTS is intentionally not implemented in the client."
650+
)
651+
652+
def cluster_bumpepoch(self, target_nodes: Optional["TargetNodesT"] = None) -> None:
653+
raise NotImplementedError(
654+
"CLUSTER BUMPEPOCH is intentionally not implemented in the client."
655+
)
656+
647657
def readonly(self, target_nodes: Optional["TargetNodesT"] = None) -> ResponseT:
648658
"""
649659
Enables read queries.

tests/test_cluster.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,14 @@ def test_cluster_links(self, r):
12891289
for i in range(0, len(res) - 1, 2):
12901290
assert res[i][3] == res[i + 1][3]
12911291

1292+
def test_cluster_flshslots_not_implemented(self, r):
1293+
with pytest.raises(NotImplementedError):
1294+
r.cluster_flushslots()
1295+
1296+
def test_cluster_bumpepoch_not_implemented(self, r):
1297+
with pytest.raises(NotImplementedError):
1298+
r.cluster_bumpepoch()
1299+
12921300
@skip_if_redis_enterprise()
12931301
def test_readonly(self):
12941302
r = get_mocked_redis_client(host=default_host, port=default_port)

0 commit comments

Comments
 (0)