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

Method test_startup_nodes

tests/test_asyncio/test_cluster.py:369–399  ·  view source on GitHub ↗

Test that it is possible to use startup_nodes argument to init the cluster

(self)

Source from the content-addressed store, hash-verified

367 await cluster.aclose()
368
369 async def test_startup_nodes(self) -> None:
370 """
371 Test that it is possible to use startup_nodes
372 argument to init the cluster
373 """
374 port_1 = 7000
375 port_2 = 7001
376 startup_nodes = [
377 ClusterNode(default_host, port_1),
378 ClusterNode(default_host, port_2),
379 ]
380 cluster = await get_mocked_redis_client(startup_nodes=startup_nodes)
381 assert (
382 cluster.get_node(host=default_host, port=port_1) is not None
383 and cluster.get_node(host=default_host, port=port_2) is not None
384 )
385
386 await cluster.aclose()
387
388 startup_node = ClusterNode("127.0.0.1", 16379)
389 async with RedisCluster(startup_nodes=[startup_node], client_name="test") as rc:
390 assert await rc.set("A", 1)
391 assert await rc.get("A") == b"1"
392 assert all(
393 [
394 name == "test"
395 for name in (
396 await rc.client_getname(target_nodes=rc.ALL_NODES)
397 ).values()
398 ]
399 )
400
401 async def test_cluster_set_get_retry_object(self, request: FixtureRequest):
402 retry = Retry(NoBackoff(), 2)

Callers

nothing calls this directly

Calls 8

ClusterNodeClass · 0.90
RedisClusterClass · 0.90
client_getnameMethod · 0.80
get_mocked_redis_clientFunction · 0.70
get_nodeMethod · 0.45
acloseMethod · 0.45
setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected