Add S3-gate testcase (#4)

* Add S3-gate testcase
This commit is contained in:
anatoly-bogatyrev 2020-12-11 14:35:02 +03:00 committed by GitHub
parent 14b780257c
commit a20ec58614
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 320 additions and 173 deletions

View file

@ -544,6 +544,21 @@ def create_container(private_key: str, basic_acl:str="", rule:str="REP 2 IN X CB
return cid
@keyword('Container List')
def container_list(private_key: str):
Cmd = f'neofs-cli --rpc-endpoint {NEOFS_ENDPOINT} --key {private_key} container list'
logger.info("Cmd: %s" % Cmd)
complProc = subprocess.run(Cmd, check=True, universal_newlines=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=15, shell=True)
logger.info("Output: %s" % complProc.stdout)
container_list = re.findall(r'(\w{43,44})', complProc.stdout)
logger.info("Containers list: %s" % container_list)
return container_list
@keyword('Container Existing')
def container_existing(private_key: str, cid: str):
Cmd = f'neofs-cli --rpc-endpoint {NEOFS_ENDPOINT} --key {private_key} container list'
@ -581,7 +596,6 @@ def search_object(private_key: str, cid: str, keys: str, bearer: str, filters: s
if bearer:
bearer_token = f"--bearer {bearer}"
if filters:
filters = f"--filters {filters}"
@ -593,20 +607,21 @@ def search_object(private_key: str, cid: str, keys: str, bearer: str, filters: s
logger.info("Output: %s" % complProc.stdout)
if expected_objects_list:
found_objects = re.findall(r'(\w{43,44})', complProc.stdout)
found_objects = re.findall(r'(\w{43,44})', complProc.stdout)
if expected_objects_list:
if sorted(found_objects) == sorted(expected_objects_list):
logger.info("Found objects list '{}' is equal for expected list '{}'".format(found_objects, expected_objects_list))
else:
raise Exception("Found object list '{}' is not equal to expected list '{}'".format(found_objects, expected_objects_list))
return found_objects
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):
@ -809,6 +824,11 @@ def delete_object(private_key: str, cid: str, oid: str, bearer: str):
raise Exception("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))
@keyword('Get file name')
def get_file_name(filepath):
filename = os.path.basename(filepath)
return filename
@keyword('Get file hash')
def get_file_hash(filename):
file_hash = _get_file_hash(filename)