diff --git a/src/frostfs_testlib/steps/cli/container.py b/src/frostfs_testlib/steps/cli/container.py index be96138..b3afd88 100644 --- a/src/frostfs_testlib/steps/cli/container.py +++ b/src/frostfs_testlib/steps/cli/container.py @@ -1,6 +1,7 @@ import json import logging import re +import requests from dataclasses import dataclass from time import sleep from typing import Optional, Union @@ -344,12 +345,13 @@ def _parse_cid(output: str) -> str: @reporter.step("Search container by name") -def search_container_by_name(wallet: str, name: str, shell: Shell, endpoint: str): - list_cids = list_containers(wallet, shell, endpoint) - for cid in list_cids: - cont_info = get_container(wallet, cid, shell, endpoint, True) - if cont_info.get("attributes", {}).get("Name", None) == name: - return cid +def search_container_by_name(name: str, node: ClusterNode): + node_shell = node.host.get_shell() + output = node_shell.exec(f"curl -I HEAD http://127.0.0.1:8084/{name}") + pattern = r"X-Container-Id: (\S+)" + cid = re.findall(pattern, output.stdout) + if cid: + return cid[0] return None diff --git a/src/frostfs_testlib/steps/s3/s3_helper.py b/src/frostfs_testlib/steps/s3/s3_helper.py index 1d7adfa..68d5379 100644 --- a/src/frostfs_testlib/steps/s3/s3_helper.py +++ b/src/frostfs_testlib/steps/s3/s3_helper.py @@ -231,6 +231,8 @@ def search_nodes_with_bucket( shell: Shell, endpoint: str, ) -> list[ClusterNode]: - cid = search_container_by_name(wallet=wallet, name=bucket_name, shell=shell, endpoint=endpoint) - nodes_list = search_nodes_with_container(wallet=wallet, cid=cid, shell=shell, endpoint=endpoint, cluster=cluster) + cid = search_container_by_name(name=bucket_name, cluster=cluster) + nodes_list = search_nodes_with_container( + wallet=wallet, cid=cid, shell=shell, endpoint=endpoint, cluster=cluster + ) return nodes_list