MCPcopy
hub / github.com/redis/redis-py / test_cluster_one_instance

Method test_cluster_one_instance

tests/test_cluster.py:3067–3084  ·  view source on GitHub ↗

If the cluster exists of only 1 node then there is some hacks that must be validated they work.

(self)

Source from the content-addressed store, hash-verified

3065
3066 @pytest.mark.fixed_client
3067 def test_cluster_one_instance(self):
3068 """
3069 If the cluster exists of only 1 node then there is some hacks that must
3070 be validated they work.
3071 """
3072 node = ClusterNode(default_host, default_port)
3073 cluster_slots = [[0, 16383, ["", default_port]]]
3074 rc = get_mocked_redis_client(startup_nodes=[node], cluster_slots=cluster_slots)
3075
3076 n = rc.nodes_manager
3077 assert len(n.nodes_cache) == 1
3078 n_node = rc.get_node(node_name=node.name)
3079 assert n_node is not None
3080 assert n_node == node
3081 assert n_node.server_type == PRIMARY
3082 assert len(n.slots_cache) == REDIS_CLUSTER_HASH_SLOTS
3083 for i in range(0, REDIS_CLUSTER_HASH_SLOTS):
3084 assert n.slots_cache[i] == [n_node]
3085
3086 @pytest.mark.fixed_client
3087 def test_init_with_down_node(self):

Callers

nothing calls this directly

Calls 3

ClusterNodeClass · 0.90
get_mocked_redis_clientFunction · 0.70
get_nodeMethod · 0.45

Tested by

no test coverage detected