From 1fbd7b7de1274a5240a6dd5cbe9014b38ef21884 Mon Sep 17 00:00:00 2001 From: Vitaliy Potyarkin Date: Tue, 6 May 2025 16:55:24 +0300 Subject: [PATCH] Allow ClusterNode.__init__ with missing services Not all component test environments will provide full set of services. It's ok for gateways and even storage nodes to be completely missing. Signed-off-by: Vitaliy Potyarkin --- src/frostfs_testlib/storage/cluster.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/frostfs_testlib/storage/cluster.py b/src/frostfs_testlib/storage/cluster.py index b67e34d..7110038 100644 --- a/src/frostfs_testlib/storage/cluster.py +++ b/src/frostfs_testlib/storage/cluster.py @@ -161,17 +161,24 @@ class Cluster: This class represents a Cluster object for the whole storage based on provided hosting """ - default_rpc_endpoint: str - default_s3_gate_endpoint: str - default_http_gate_endpoint: str + default_rpc_endpoint: str = "not deployed" + default_s3_gate_endpoint: str = "not deployed" + default_http_gate_endpoint: str = "not deployed" def __init__(self, hosting: Hosting) -> None: self._hosting = hosting self.class_registry = get_service_registry() - self.default_rpc_endpoint = self.services(StorageNode)[0].get_rpc_endpoint() - self.default_s3_gate_endpoint = self.services(S3Gate)[0].get_endpoint() - self.default_http_gate_endpoint = self.services(HTTPGate)[0].get_endpoint() + + storage = self.services(StorageNode) + if storage: + self.default_rpc_endpoint = storage[0].get_rpc_endpoint() + s3gate = self.services(S3Gate) + if s3gate: + self.default_s3_gate_endpoint = s3gate[0].get_endpoint() + http_gate = self.services(HTTPGate) + if http_gate: + self.default_http_gate_endpoint = http_gate[0].get_endpoint() @property def hosts(self) -> list[Host]: