Skip to content

Commit

Permalink
Throw NotImplementedError for FAILOVER (#1911)
Browse files Browse the repository at this point in the history
* unsupported failover

* add test and docstring

* fix docstring
  • Loading branch information
dvora-h committed Feb 6, 2022
1 parent d7dab86 commit f9d8091
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions redis/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,15 @@ def wait(self, num_replicas, timeout, **kwargs):
"""
return self.execute_command("WAIT", num_replicas, timeout, **kwargs)

def failover(self):
"""
This function throws a NotImplementedError since it is intentionally
not supported.
"""
raise NotImplementedError(
"FAILOVER is intentionally not implemented in the client."
)


class BasicKeyCommands:
"""
Expand Down
5 changes: 5 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,11 @@ def test_config_set(self, r):
assert r.config_set("timeout", 0)
assert r.config_get()["timeout"] == "0"

@skip_if_server_version_lt("6.0.0")
def test_failover(self, r):
with pytest.raises(NotImplementedError):
r.failover()

@pytest.mark.onlynoncluster
def test_dbsize(self, r):
r["a"] = "foo"
Expand Down

0 comments on commit f9d8091

Please sign in to comment.