forked from TrueCloudLab/frostfs-testcases
update
This commit is contained in:
parent
b7a30c763d
commit
0857de8f77
2 changed files with 52 additions and 139 deletions
|
@ -54,7 +54,6 @@ def get_scripthash(privkey: str):
|
|||
return scripthash
|
||||
|
||||
|
||||
|
||||
@keyword('Get nodes with object')
|
||||
def get_nodes_with_object(private_key: str, cid, oid):
|
||||
storage_nodes = _get_storage_nodes(private_key)
|
||||
|
@ -140,17 +139,6 @@ def get_eacl(private_key: bytes, cid: str):
|
|||
|
||||
|
||||
|
||||
|
||||
@keyword('Convert Str to Hex Str with Len')
|
||||
def conver_str_to_hex(string_convert: str):
|
||||
converted = binascii.hexlify(bytes(string_convert, encoding= 'utf-8')).decode("utf-8")
|
||||
prev_len_2 = '{:04x}'.format(int(len(converted)/2))
|
||||
|
||||
return str(prev_len_2)+str(converted)
|
||||
|
||||
|
||||
|
||||
|
||||
@keyword('Set eACL')
|
||||
def set_eacl(private_key: str, cid: str, eacl: str, add_keys: str = ""):
|
||||
|
||||
|
@ -504,10 +492,6 @@ def create_container(private_key: str, basic_acl:str="", rule:str="REP 2 IN X CB
|
|||
cid = _parse_cid(output)
|
||||
logger.info("Created container %s with rule '%s'" % (cid, rule))
|
||||
|
||||
#$ ./bin/neofs-cli -c config.yml container create --policy rule.ql --await
|
||||
#container ID: GePis2sDpYqYPh4F8vfGUqoujtNcqdXhipbLx2pKbUwX
|
||||
|
||||
# REP 1 IN X CBF 1 SELECT 2 IN SAME Location FROM * AS X
|
||||
return cid
|
||||
|
||||
|
||||
|
@ -574,11 +558,11 @@ def search_object(private_key: str, cid: str, keys: str, bearer: str, filters: s
|
|||
except subprocess.CalledProcessError as e:
|
||||
raise Exception("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))
|
||||
|
||||
|
||||
'''
|
||||
@keyword('Verify Head Tombstone')
|
||||
def verify_head_tombstone(private_key: str, cid: str, oid: str):
|
||||
|
||||
ObjectCmd = f'{CLI_PREFIX}neofs-cli --host {NEOFS_ENDPOINT} --key {binascii.hexlify(private_key).decode()} object head --cid {cid} --oid {oid} --full-headers'
|
||||
ObjectCmd = f'neofs-cli --rpc-endpoint {NEOFS_ENDPOINT} --key {private_key} object head --cid {cid} --oid {oid} --full-headers'
|
||||
logger.info("Cmd: %s" % ObjectCmd)
|
||||
try:
|
||||
complProc = subprocess.run(ObjectCmd, check=True, universal_newlines=True,
|
||||
|
@ -592,26 +576,10 @@ def verify_head_tombstone(private_key: str, cid: str, oid: str):
|
|||
|
||||
except subprocess.CalledProcessError as e:
|
||||
raise Exception("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))
|
||||
'''
|
||||
|
||||
|
||||
|
||||
|
||||
def _exec_cli_cmd(private_key: bytes, postfix: str):
|
||||
|
||||
# Get linked objects from first
|
||||
ObjectCmd = f'{CLI_PREFIX}neofs-cli --raw --host {NEOFS_ENDPOINT} --key {binascii.hexlify(private_key).decode()} {postfix}'
|
||||
logger.info("Cmd: %s" % ObjectCmd)
|
||||
try:
|
||||
complProc = subprocess.run(ObjectCmd, check=True, universal_newlines=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=15, shell=True)
|
||||
logger.info("Output: %s" % complProc.stdout)
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
raise Exception("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))
|
||||
|
||||
return complProc.stdout
|
||||
|
||||
|
||||
'''
|
||||
@keyword('Verify linked objects')
|
||||
def verify_linked_objects(private_key: bytes, cid: str, oid: str, payload_size: float):
|
||||
|
||||
|
@ -655,6 +623,7 @@ def verify_linked_objects(private_key: bytes, cid: str, oid: str, payload_size:
|
|||
|
||||
return child_obj_list_headers.keys()
|
||||
|
||||
|
||||
def _check_linked_object(obj:str, child_obj_list_headers:dict, payload_size:int, payload:int, parent_id:str):
|
||||
|
||||
output = child_obj_list_headers[obj]
|
||||
|
@ -695,6 +664,8 @@ def _check_linked_object(obj:str, child_obj_list_headers:dict, payload_size:int,
|
|||
else:
|
||||
raise Exception("Can not get Next object ID for the object %s." % obj)
|
||||
|
||||
'''
|
||||
|
||||
|
||||
@keyword('Head object')
|
||||
def head_object(private_key: str, cid: str, oid: str, bearer: str, user_headers:str=""):
|
||||
|
@ -760,8 +731,6 @@ def parse_object_system_header(header: str):
|
|||
else:
|
||||
raise Exception("no PayloadLength was parsed from object header: \t%s" % output)
|
||||
|
||||
|
||||
|
||||
# CreatedAtUnixTime
|
||||
m = re.search(r'Timestamp=(\d+)', header)
|
||||
if m.start() != m.end(): # e.g., if match found something
|
||||
|
@ -779,26 +748,6 @@ def parse_object_system_header(header: str):
|
|||
logger.info("Result: %s" % result_header)
|
||||
return result_header
|
||||
|
||||
|
||||
|
||||
@keyword('Parse Object Extended Header')
|
||||
def parse_object_extended_header(header: str):
|
||||
result_header = dict()
|
||||
|
||||
|
||||
pattern = re.compile(r'- Type=(\w+)\n.+Value=(.+)\n')
|
||||
|
||||
|
||||
for (f_type, f_val) in re.findall(pattern, header):
|
||||
logger.info("found: %s - %s" % (f_type, f_val))
|
||||
if f_type not in result_header.keys():
|
||||
result_header[f_type] = []
|
||||
|
||||
result_header[f_type].append(f_val)
|
||||
|
||||
logger.info("Result: %s" % result_header)
|
||||
return result_header
|
||||
|
||||
|
||||
@keyword('Delete object')
|
||||
def delete_object(private_key: str, cid: str, oid: str, bearer: str):
|
||||
|
@ -830,7 +779,7 @@ def verify_file_hash(filename, expected_hash):
|
|||
else:
|
||||
raise Exception("File hash '{}' is not equal to {}".format(file_hash, expected_hash))
|
||||
|
||||
|
||||
'''
|
||||
@keyword('Create storage group')
|
||||
def create_storage_group(private_key: bytes, cid: str, *objects_list):
|
||||
objects = ""
|
||||
|
@ -856,7 +805,8 @@ def get_storage_group(private_key: bytes, cid: str, sgid: str):
|
|||
logger.info("Output: %s" % complProc.stdout)
|
||||
except subprocess.CalledProcessError as e:
|
||||
raise Exception("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))
|
||||
|
||||
'''
|
||||
|
||||
|
||||
@keyword('Cleanup File')
|
||||
# remove temp files
|
||||
|
@ -930,6 +880,23 @@ def get_object(private_key: str, cid: str, oid: str, bearer_token: str, read_obj
|
|||
raise Exception("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))
|
||||
|
||||
|
||||
|
||||
def _exec_cli_cmd(private_key: bytes, postfix: str):
|
||||
|
||||
# Get linked objects from first
|
||||
ObjectCmd = f'{CLI_PREFIX}neofs-cli --raw --host {NEOFS_ENDPOINT} --key {binascii.hexlify(private_key).decode()} {postfix}'
|
||||
logger.info("Cmd: %s" % ObjectCmd)
|
||||
try:
|
||||
complProc = subprocess.run(ObjectCmd, check=True, universal_newlines=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=15, shell=True)
|
||||
logger.info("Output: %s" % complProc.stdout)
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
raise Exception("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))
|
||||
|
||||
return complProc.stdout
|
||||
|
||||
|
||||
def _get_file_hash(filename):
|
||||
blocksize = 65536
|
||||
hash = hashlib.md5()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue