Test that it is possible to use startup_nodes argument to init the cluster
(self)
| 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) |
nothing calls this directly
no test coverage detected