Skip to content

Commit f9d8091

Browse files
authored
Throw NotImplementedError for FAILOVER (#1911)
* unsupported failover * add test and docstring * fix docstring
1 parent d7dab86 commit f9d8091

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

redis/commands/core.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,15 @@ def wait(self, num_replicas, timeout, **kwargs):
10871087
"""
10881088
return self.execute_command("WAIT", num_replicas, timeout, **kwargs)
10891089

1090+
def failover(self):
1091+
"""
1092+
This function throws a NotImplementedError since it is intentionally
1093+
not supported.
1094+
"""
1095+
raise NotImplementedError(
1096+
"FAILOVER is intentionally not implemented in the client."
1097+
)
1098+
10901099

10911100
class BasicKeyCommands:
10921101
"""

tests/test_commands.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,11 @@ def test_config_set(self, r):
647647
assert r.config_set("timeout", 0)
648648
assert r.config_get()["timeout"] == "0"
649649

650+
@skip_if_server_version_lt("6.0.0")
651+
def test_failover(self, r):
652+
with pytest.raises(NotImplementedError):
653+
r.failover()
654+
650655
@pytest.mark.onlynoncluster
651656
def test_dbsize(self, r):
652657
r["a"] = "foo"

0 commit comments

Comments
 (0)