From 89c67b17b42bf01b80033bdfaecb8dd73e1e0cdd Mon Sep 17 00:00:00 2001 From: dvora-h Date: Mon, 12 Dec 2022 16:49:14 +0200 Subject: [PATCH] Raising NotImplementedError for certain CLUSTER commands --- redis/commands/cluster.py | 10 ++++++++++ tests/test_cluster.py | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/redis/commands/cluster.py b/redis/commands/cluster.py index f0eaaf75c5..f434f365a1 100644 --- a/redis/commands/cluster.py +++ b/redis/commands/cluster.py @@ -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. diff --git a/tests/test_cluster.py b/tests/test_cluster.py index 43aeb9e045..51a076f10f 100644 --- a/tests/test_cluster.py +++ b/tests/test_cluster.py @@ -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)