diff options
author | Chayim <chayim@users.noreply.github.com> | 2021-08-29 11:21:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-29 11:21:01 +0300 |
commit | 7c77883596e9e28c2d04298bf15ad9f947dd907f (patch) | |
tree | 1a9f6f8e5b0e07cf8856c337a6c16b0a00057b84 /tests/test_sentinel.py | |
parent | 8cfea4137851fa49c7d211b782800dd696b67c39 (diff) | |
download | redis-py-7c77883596e9e28c2d04298bf15ad9f947dd907f.tar.gz |
Merged new sentinel commands from #834 (#1550)
* Merged new sentinel commands from #835
Thanks you @otherpirate for the contribution!
* Added an execute wrapper and tests.
The tests ensure that the function is called. Nothing more since we do not currently have enough testing support for sentinel
Diffstat (limited to 'tests/test_sentinel.py')
-rw-r--r-- | tests/test_sentinel.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/test_sentinel.py b/tests/test_sentinel.py index 64a7c47..54cf262 100644 --- a/tests/test_sentinel.py +++ b/tests/test_sentinel.py @@ -30,9 +30,15 @@ class SentinelTestClient: return [] return self.cluster.slaves + def execute_command(self, *args, **kwargs): + # wrapper purely to validate the calls don't explode + from redis.client import bool_ok + return bool_ok + class SentinelTestCluster: - def __init__(self, service_name='mymaster', ip='127.0.0.1', port=6379): + def __init__(self, servisentinel_ce_name='mymaster', ip='127.0.0.1', + port=6379): self.clients = {} self.master = { 'ip': ip, @@ -42,7 +48,7 @@ class SentinelTestCluster: 'is_odown': False, 'num-other-sentinels': 0, } - self.service_name = service_name + self.service_name = servisentinel_ce_name self.slaves = [] self.nodes_down = set() self.nodes_timeout = set() @@ -198,3 +204,16 @@ def test_slave_round_robin(cluster, sentinel, master_ip): assert next(rotator) == (master_ip, 6379) with pytest.raises(SlaveNotFoundError): next(rotator) + + +def test_ckquorum(cluster, sentinel): + assert sentinel.sentinel_ckquorum("mymaster") + + +def test_flushconfig(cluster, sentinel): + assert sentinel.sentinel_flushconfig() + + +def test_reset(cluster, sentinel): + cluster.master['is_odown'] = True + assert sentinel.sentinel_reset('mymaster') |