From 974915c1ca6dddf0bbc37a7137a8bf042e23e26c Mon Sep 17 00:00:00 2001 From: Vitaliy Potyarkin Date: Mon, 12 May 2025 18:44:26 +0300 Subject: [PATCH] cli: Also parse domain names when looking for container node Previous implementation was searching only for IPv4 addresses when selecting container nodes from Cluster. It also was only looking at ClusterNodes which provide morph_chain, which is not always required to be present on a storage node. Signed-off-by: Vitaliy Potyarkin --- src/frostfs_testlib/steps/cli/container.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/frostfs_testlib/steps/cli/container.py b/src/frostfs_testlib/steps/cli/container.py index 092b1a3..978e8a8 100644 --- a/src/frostfs_testlib/steps/cli/container.py +++ b/src/frostfs_testlib/steps/cli/container.py @@ -341,11 +341,13 @@ def search_nodes_with_container( cli = FrostfsCli(shell, FROSTFS_CLI_EXEC, wallet.config_path) result = cli.container.search_node(rpc_endpoint=endpoint, cid=cid, timeout=timeout) - pattern = r"[0-9]+(?:\.[0-9]+){3}" - nodes_ip = list(set(re.findall(pattern, result.stdout))) + addrs = list(set(re.findall(r"(?<=/ip[46]/)[^/]+(?=/)", result.stdout))) + hostnames = list(set(re.findall(r"(?<=/dns[46]/)[^/]+(?=/)", result.stdout))) - with reporter.step(f"nodes ips = {nodes_ip}"): - nodes_list = cluster.get_nodes_by_ip(nodes_ip) - - with reporter.step(f"Return nodes - {nodes_list}"): - return nodes_list + nodes = [] + for node in cluster.cluster_nodes: + host = node.host.config + if host.address in addrs or host.hostname in hostnames: + nodes.append(node) + with reporter.step(f"Return nodes - {nodes}"): + return nodes