forked from TrueCloudLab/frostfs-testcases
fixed miscellaneous errors
Signed-off-by: anastasia prasolova <anastasia@nspcc.ru>
This commit is contained in:
parent
2f774f5995
commit
ffa40112a1
5 changed files with 122 additions and 76 deletions
|
@ -28,7 +28,8 @@ def _cmd_run(cmd, timeout=30):
|
|||
logger.info(f"Executing command: {cmd}")
|
||||
start_time = datetime.now()
|
||||
compl_proc = subprocess.run(cmd, check=True, universal_newlines=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=timeout,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
||||
timeout=timeout,
|
||||
shell=True)
|
||||
output = compl_proc.stdout
|
||||
return_code = compl_proc.returncode
|
||||
|
@ -40,6 +41,8 @@ def _cmd_run(cmd, timeout=30):
|
|||
except subprocess.CalledProcessError as exc:
|
||||
raise RuntimeError(f"Error:\nreturn code: {exc.returncode} "
|
||||
f"\nOutput: {exc.output}") from exc
|
||||
except OSError as exc:
|
||||
raise RuntimeError(f"Output: {exc.strerror}") from exc
|
||||
except Exception as exc:
|
||||
return_code, _ = subprocess.getstatusoutput(cmd)
|
||||
logger.info(f"Error:\nreturn code: {return_code}\nOutput: "
|
||||
|
|
|
@ -10,13 +10,12 @@ import random
|
|||
import re
|
||||
import uuid
|
||||
|
||||
from robot.api import logger
|
||||
from robot.api.deco import keyword
|
||||
|
||||
from common import NEOFS_ENDPOINT, ASSETS_DIR, NEOFS_NETMAP, WALLET_CONFIG
|
||||
import json_transformers
|
||||
from cli_helpers import _cmd_run
|
||||
from common import ASSETS_DIR, NEOFS_ENDPOINT, NEOFS_NETMAP, WALLET_CONFIG
|
||||
from data_formatters import dict_to_attrs
|
||||
from robot.api import logger
|
||||
from robot.api.deco import keyword
|
||||
|
||||
ROBOT_AUTO_KEYWORDS = False
|
||||
|
||||
|
@ -126,7 +125,7 @@ def put_object(wallet: str, path: str, cid: str, bearer: str = "", user_headers:
|
|||
|
||||
@keyword('Delete object')
|
||||
def delete_object(wallet: str, cid: str, oid: str, bearer: str = "", wallet_config: str = WALLET_CONFIG,
|
||||
options: str = ""):
|
||||
options: str = ""):
|
||||
"""
|
||||
DELETE an Object.
|
||||
|
||||
|
@ -187,7 +186,7 @@ def get_range(wallet: str, cid: str, oid: str, file_path: str, bearer: str, rang
|
|||
|
||||
@keyword('Search object')
|
||||
def search_object(wallet: str, cid: str, keys: str = "", bearer: str = "", filters: dict = {},
|
||||
expected_objects_list=[], wallet_config: str = WALLET_CONFIG):
|
||||
expected_objects_list=[], wallet_config: str = WALLET_CONFIG, options: str = ""):
|
||||
"""
|
||||
SEARCH an Object.
|
||||
|
||||
|
@ -200,6 +199,7 @@ def search_object(wallet: str, cid: str, keys: str = "", bearer: str = "", filte
|
|||
filters (optional, dict): key=value pairs to filter Objects
|
||||
expected_objects_list (optional, list): a list of ObjectIDs to compare found Objects with
|
||||
wallet_config(optional, str): path to the wallet config
|
||||
options(optional, str): any other options which `neofs-cli object search` might accept
|
||||
Returns:
|
||||
(list): list of found ObjectIDs
|
||||
"""
|
||||
|
@ -207,12 +207,13 @@ def search_object(wallet: str, cid: str, keys: str = "", bearer: str = "", filte
|
|||
if filters:
|
||||
filters_result += "--filters "
|
||||
logger.info(filters)
|
||||
filters_result += ','.join(map(lambda i: f"'{i} EQ {filters[i]}'", filters))
|
||||
filters_result += ','.join(
|
||||
map(lambda i: f"'{i} EQ {filters[i]}'", filters))
|
||||
|
||||
cmd = (
|
||||
f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} --wallet {wallet} '
|
||||
f'object search {keys} --cid {cid} {filters_result} --config {wallet_config} '
|
||||
f'{"--bearer " + bearer if bearer else ""}'
|
||||
f'{"--bearer " + bearer if bearer else ""} {options}'
|
||||
)
|
||||
output = _cmd_run(cmd)
|
||||
|
||||
|
|
|
@ -2,18 +2,20 @@
|
|||
|
||||
import json
|
||||
|
||||
import neofs_verbs
|
||||
from neo3 import wallet
|
||||
from robot.api.deco import keyword
|
||||
from robot.libraries.BuiltIn import BuiltIn
|
||||
|
||||
import neofs_verbs
|
||||
|
||||
ROBOT_AUTO_KEYWORDS = False
|
||||
|
||||
|
||||
@keyword('Verify Head Tombstone')
|
||||
def verify_head_tombstone(wallet_path: str, cid: str, oid_ts: str, oid: str):
|
||||
header = neofs_verbs.head_object(wallet_path, cid, oid_ts)
|
||||
def verify_head_tombstone(wallet_path: str, cid: str, oid_ts: str, oid: str,
|
||||
bearer: str = "", options: str = ""):
|
||||
header = neofs_verbs.head_object(wallet_path, cid, oid_ts,
|
||||
bearer_token=bearer,
|
||||
options=options)
|
||||
header = header['header']
|
||||
|
||||
BuiltIn().should_be_equal(header["containerID"], cid,
|
||||
|
@ -32,18 +34,18 @@ def verify_head_tombstone(wallet_path: str, cid: str, oid_ts: str, oid: str):
|
|||
msg="Header Type isn't Tombstone")
|
||||
|
||||
BuiltIn().should_be_equal(
|
||||
header["sessionToken"]["body"]["object"]["verb"], 'DELETE',
|
||||
msg="Header Session Type isn't DELETE"
|
||||
)
|
||||
header["sessionToken"]["body"]["object"]["verb"], 'DELETE',
|
||||
msg="Header Session Type isn't DELETE"
|
||||
)
|
||||
|
||||
BuiltIn().should_be_equal(
|
||||
header["sessionToken"]["body"]["object"]["address"]["containerID"],
|
||||
cid,
|
||||
msg="Header Session ID is wrong"
|
||||
)
|
||||
header["sessionToken"]["body"]["object"]["address"]["containerID"],
|
||||
cid,
|
||||
msg="Header Session ID is wrong"
|
||||
)
|
||||
|
||||
BuiltIn().should_be_equal(
|
||||
header["sessionToken"]["body"]["object"]["address"]["objectID"],
|
||||
oid,
|
||||
msg="Header Session OID is wrong"
|
||||
)
|
||||
header["sessionToken"]["body"]["object"]["address"]["objectID"],
|
||||
oid,
|
||||
msg="Header Session OID is wrong"
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue