-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Evgeniy Zayats <[email protected]>
- Loading branch information
Evgeniy Zayats
committed
Jan 19, 2024
1 parent
81aa373
commit ec862bf
Showing
4 changed files
with
1,094 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import logging | ||
|
||
import allure | ||
import neofs_verbs | ||
from neofs_testlib.env.env import StorageNode | ||
from neofs_testlib.shell import Shell | ||
|
||
logger = logging.getLogger("NeoLogger") | ||
|
||
|
||
@allure.step("Get Simple Object Copies") | ||
def get_simple_object_copies( | ||
wallet: str, cid: str, oid: str, shell: Shell, nodes: list[StorageNode] | ||
) -> int: | ||
""" | ||
To figure out the number of a simple object copies, only direct | ||
HEAD requests should be made to the every node of the container. | ||
We consider non-empty HEAD response as a stored object copy. | ||
Args: | ||
wallet (str): the path to the wallet on whose behalf the | ||
copies are got | ||
cid (str): ID of the container | ||
oid (str): ID of the Object | ||
shell: executor for cli command | ||
nodes: nodes to search on | ||
Returns: | ||
(int): the number of object copies in the container | ||
""" | ||
copies = 0 | ||
for node in nodes: | ||
try: | ||
response = neofs_verbs.head_object( | ||
wallet, cid, oid, shell=shell, endpoint=node.endpoint, is_direct=True | ||
) | ||
if response: | ||
logger.info(f"Found object {oid} on node {node}") | ||
copies += 1 | ||
except Exception: | ||
logger.info(f"No {oid} object copy found on {node}, continue") | ||
continue | ||
return copies |
Oops, something went wrong.