From d940fe9573704aec1e080f27d1c9e19270a6df92 Mon Sep 17 00:00:00 2001 From: anastasia prasolova Date: Fri, 6 May 2022 12:53:02 +0300 Subject: [PATCH] storage group operations moved from neofs.py; storage group tests refactored Signed-off-by: anastasia prasolova --- .../lib/python/complex_object_actions.py | 6 +- robot/resources/lib/python/neofs.py | 84 ----------- robot/resources/lib/python/storage_group.py | 126 +++++++++++++++++ .../lib/robot/common_steps_acl_bearer.robot | 1 - .../lib/robot/complex_object_operations.robot | 6 +- robot/resources/lib/robot/storage_group.robot | 131 ++++++++++++++++++ ...basic_private_container_storagegroup.robot | 69 +++------ ..._basic_public_container_storagegroup.robot | 59 +++----- .../acl/acl_basic_readonly_container.robot | 47 ++----- ...asic_readonly_container_storagegroup.robot | 60 +++----- .../acl/acl_bearer_allow_storagegroup.robot | 70 ++++------ .../object/object_storagegroup_complex.robot | 54 +++----- .../object/object_storagegroup_simple.robot | 51 +++---- robot/variables/common.py | 4 +- 14 files changed, 389 insertions(+), 379 deletions(-) create mode 100644 robot/resources/lib/python/storage_group.py create mode 100644 robot/resources/lib/robot/storage_group.robot diff --git a/robot/resources/lib/python/complex_object_actions.py b/robot/resources/lib/python/complex_object_actions.py index f112442..2d473b6 100644 --- a/robot/resources/lib/python/complex_object_actions.py +++ b/robot/resources/lib/python/complex_object_actions.py @@ -21,13 +21,14 @@ ROBOT_AUTO_KEYWORDS = False @keyword('Get Link Object') -def get_link_object(wallet: str, cid: str, oid: str): +def get_link_object(wallet: str, cid: str, oid: str, bearer_token: str=""): """ Args: wallet (str): path to the wallet on whose behalf the Storage Nodes are requested cid (str): Container ID which stores the Large Object oid (str): Large Object ID + bearer_token (optional, str): path to Bearer token file Returns: (str): Link Object ID When no Link Object ID is found after all Storage Nodes polling, @@ -38,7 +39,8 @@ def get_link_object(wallet: str, cid: str, oid: str): resp = neofs_verbs.head_object(wallet, cid, oid, endpoint=node, is_raw=True, - is_direct=True) + is_direct=True, + bearer_token=bearer_token) if resp['link']: return resp['link'] except Exception: diff --git a/robot/resources/lib/python/neofs.py b/robot/resources/lib/python/neofs.py index 5f4e2d1..68871bb 100644 --- a/robot/resources/lib/python/neofs.py +++ b/robot/resources/lib/python/neofs.py @@ -264,90 +264,6 @@ def find_in_nodes_Log(line: str, nodes_logs_time: dict): return 1 -@keyword('Put Storagegroup') -def put_storagegroup(wallet: str, cid: str, bearer_token: str="", *oid_list): - - cmd_oid_line = ",".join(oid_list) - - if bearer_token: - bearer_token = f"--bearer {bearer_token}" - - object_cmd = ( - f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} --wallet {wallet} --config {WALLET_PASS} ' - f'storagegroup put --cid {cid} --members {cmd_oid_line} {bearer_token}' - ) - output = _cmd_run(object_cmd) - oid = _parse_oid(output) - - return oid - - -@keyword('List Storagegroup') -def list_storagegroup(wallet: str, cid: str, bearer_token: str="", *expected_list): - - if bearer_token: - bearer_token = f"--bearer {bearer_token}" - - object_cmd = ( - f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} --wallet {wallet} ' - f'--config {WALLET_PASS} storagegroup list --cid {cid} {bearer_token}' - ) - output = _cmd_run(object_cmd) - found_objects = re.findall(r'(\w{43,44})', output) - - if expected_list: - if sorted(found_objects) == sorted(expected_list): - logger.info(f"Found storage group list '{found_objects}' is equal for expected list '{expected_list}'") - else: - raise Exception(f"Found storage group '{found_objects}' is not equal to expected list '{expected_list}'") - - return found_objects - - -@keyword('Get Storagegroup') -def get_storagegroup(wallet: str, cid: str, oid: str, bearer_token: str, expected_size, *expected_objects_list): - - if bearer_token: - bearer_token = f"--bearer {bearer_token}" - - object_cmd = f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} --wallet {private_key} storagegroup get --cid {cid} --id {oid} {bearer_token}' - output = _cmd_run(object_cmd) - - if expected_size: - if re.search(fr'Group size: {expected_size}', output): - logger.info(f"Group size {expected_size} has been found in the output") - else: - raise Exception(f"Group size {expected_size} has not been found in the output") - - found_objects = re.findall(r'\s(\w{43,44})\s', output) - - if expected_objects_list: - if sorted(found_objects) == sorted(expected_objects_list): - logger.info(f"Found objects list '{found_objects}' is equal for expected list '{expected_objects_list}'") - else: - raise Exception(f"Found object list '{found_objects}' is not equal to expected list '{expected_objects_list}'") - - -@keyword('Delete Storagegroup') -def delete_storagegroup(wallet: str, cid: str, oid: str, bearer_token: str=""): - - if bearer_token: - bearer_token = f"--bearer {bearer_token}" - - object_cmd = ( - f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} --wallet {wallet} storagegroup ' - f'delete --cid {cid} --config {WALLET_PASS} --id {oid} {bearer_token}' - ) - output = _cmd_run(object_cmd) - - m = re.search(r'Tombstone: ([a-zA-Z0-9-]+)', output) - if m.start() != m.end(): # e.g., if match found something - oid = m.group(1) - else: - raise Exception(f"no Tombstone ID was parsed from command output: \t{output}") - return oid - - @keyword('Generate Session Token') def generate_session_token(owner: str, pub_key: str, cid: str = "", wildcard: bool = False) -> str: diff --git a/robot/resources/lib/python/storage_group.py b/robot/resources/lib/python/storage_group.py new file mode 100644 index 0000000..c82686b --- /dev/null +++ b/robot/resources/lib/python/storage_group.py @@ -0,0 +1,126 @@ +#!/usr/bin/python3 + +""" + This module contains keywords for work with Storage Groups. + It contains wrappers for `neofs-cli storagegroup` verbs. +""" + +from cli_helpers import _cmd_run + +from common import NEOFS_CLI_EXEC, NEOFS_ENDPOINT, WALLET_PASS +from robot.api.deco import keyword + +ROBOT_AUTO_KEYWORDS = False + + +@keyword('Put Storagegroup') +def put_storagegroup(wallet: str, cid: str, objects: list, bearer_token: str=""): + """ + Wrapper for `neofs-cli storagegroup put`. Before the SG is created, + neofs-cli performs HEAD on `objects`, so this verb must be allowed + for `wallet` in `cid`. + Args: + wallet (str): path to wallet on whose behalf the SG is created + cid (str): ID of Container to put SG to + objects (list): list of Object IDs to include into the SG + bearer_token (optional, str): path to Bearer token file + Returns: + (str): Object ID of created Storage Group + """ + cmd = ( + f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} ' + f'--wallet {wallet} --config {WALLET_PASS} ' + f'storagegroup put --cid {cid} ' + f'--members {",".join(objects)} ' + f'{"--bearer " + bearer_token if bearer_token else ""}' + ) + output = _cmd_run(cmd) + oid = output.split('\n')[1].split(': ')[1] + return oid + + +@keyword('List Storagegroup') +def list_storagegroup(wallet: str, cid: str, bearer_token: str=""): + """ + Wrapper for `neofs-cli storagegroup list`. This operation + requires SEARCH allowed for `wallet` in `cid`. + Args: + wallet (str): path to wallet on whose behalf the SGs are + listed in the container + cid (str): ID of Container to list + bearer_token (optional, str): path to Bearer token file + Returns: + (list): Object IDs of found Storage Groups + """ + cmd = ( + f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} ' + f'--wallet {wallet} --config {WALLET_PASS} storagegroup list ' + f'--cid {cid} {"--bearer " + bearer_token if bearer_token else ""}' + ) + output = _cmd_run(cmd) + # throwing off the first string of output + found_objects = output.split('\n')[1:] + return found_objects + + +@keyword('Get Storagegroup') +def get_storagegroup(wallet: str, cid: str, oid: str, bearer_token: str=''): + """ + Wrapper for `neofs-cli storagegroup get`. + Args: + wallet (str): path to wallet on whose behalf the SG is got + cid (str): ID of Container where SG is stored + oid (str): ID of the Storage Group + bearer_token (optional, str): path to Bearer token file + Returns: + (dict): detailed information on the Storage Group + """ + + cmd = ( + f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} ' + f'--wallet {wallet} --config {WALLET_PASS} ' + f'storagegroup get --cid {cid} --id {oid} ' + f'{"--bearer " + bearer_token if bearer_token else ""}' + ) + output = _cmd_run(cmd) + + # TODO: temporary solution for parsing output. Needs to be replaced with + # JSON parsing when https://github.com/nspcc-dev/neofs-node/issues/1355 + # is done. + strings = output.strip().split('\n') + # first three strings go to `data`; + # skip the 'Members:' string; + # the rest of strings go to `members` + data, members = strings[:3], strings[3:] + sg_dict = {} + for i in data: + key, val = i.split(': ') + sg_dict[key] = val + sg_dict['Members'] = [] + for member in members[1:]: + sg_dict['Members'].append(member.strip()) + return sg_dict + + +@keyword('Delete Storagegroup') +def delete_storagegroup(wallet: str, cid: str, oid: str, bearer_token: str=""): + """ + Wrapper for `neofs-cli storagegroup delete`. + Args: + wallet (str): path to wallet on whose behalf the SG is deleted + cid (str): ID of Container where SG is stored + oid (str): ID of the Storage Group + bearer_token (optional, str): path to Bearer token file + Returns: + (str): Tombstone ID of the deleted Storage Group + """ + + cmd = ( + f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} ' + f'--wallet {wallet} --config {WALLET_PASS} ' + f'storagegroup delete --cid {cid} --id {oid} ' + f'{"--bearer " + bearer_token if bearer_token else ""}' + ) + output = _cmd_run(cmd) + tombstone_id = output.strip().split('\n')[1].split(': ')[1] + return tombstone_id diff --git a/robot/resources/lib/robot/common_steps_acl_bearer.robot b/robot/resources/lib/robot/common_steps_acl_bearer.robot index 7fbe589..8a8994d 100644 --- a/robot/resources/lib/robot/common_steps_acl_bearer.robot +++ b/robot/resources/lib/robot/common_steps_acl_bearer.robot @@ -26,7 +26,6 @@ Generate file Prepare eACL Role rules [Arguments] ${CID} - Log Set eACL for different Role cases # eACL rules for all operations and similar permissions @{Roles} = Create List others user system diff --git a/robot/resources/lib/robot/complex_object_operations.robot b/robot/resources/lib/robot/complex_object_operations.robot index c5e370b..ee7ced2 100644 --- a/robot/resources/lib/robot/complex_object_operations.robot +++ b/robot/resources/lib/robot/complex_object_operations.robot @@ -11,10 +11,12 @@ Get Object Parts By Link Object [Documentation] The keyword accepts the ID of a Large Object, retrieves its split ... header and returns all Part Object IDs from Link Object. - [Arguments] ${WALLET} ${CID} ${LARGE_OID} + [Arguments] ${WALLET} ${CID} ${LARGE_OID} ${BEARER}=${EMPTY} ${LINK_OID} = Get Link Object ${WALLET} ${CID} ${LARGE_OID} - &{LINK_HEADER} = Head Object ${WALLET} ${CID} ${LINK_OID} is_raw=True + ... bearer_token=${BEARER} + &{LINK_HEADER} = Head Object ${WALLET} ${CID} ${LINK_OID} + ... is_raw=True bearer_token=${BEARER} [Return] ${LINK_HEADER.header.split.children} diff --git a/robot/resources/lib/robot/storage_group.robot b/robot/resources/lib/robot/storage_group.robot new file mode 100644 index 0000000..614527e --- /dev/null +++ b/robot/resources/lib/robot/storage_group.robot @@ -0,0 +1,131 @@ +*** Settings *** +Variables common.py + +Library storage_group.py +Library Collections + +Resource complex_object_operations.robot +Resource payment_operations.robot + +*** Variables *** +${PERMISSION_ERROR} = status: code = 2048 message = access to object operation denied + +*** Keywords *** + +Run Storage Group Operations And Expect Success + [Arguments] ${WALLET} ${CID} ${OBJECTS} ${OBJ_COMPLEXITY} + [Documentation] This keyword verifies if Object's owner is granted to + ... Put, List, Get and Delete a Storage Group which contains + ... the Object. + + ${SG} = Put Storagegroup ${WALLET} ${CID} ${OBJECTS} + Verify List Storage Group ${WALLET} ${CID} ${SG} + Verify Get Storage Group ${WALLET} ${CID} ${SG} ${OBJECTS} ${OBJ_COMPLEXITY} + Delete Storagegroup ${WALLET} ${CID} ${SG} + + +Run Storage Group Operations And Expect Failure + [Arguments] ${WALLET} ${CID} ${OBJECTS} ${SG} + [Documentation] This keyword verifies if Object's owner isn't granted to + ... Put, List, Get and Delete a Storage Group which contains + ... the Object. + + ${ERR} = Run Keyword And Expect Error * + ... Put Storagegroup ${WALLET} ${CID} ${OBJECTS} + Should Contain ${ERR} ${PERMISSION_ERROR} + ${ERR} = Run Keyword And Expect Error * + ... List Storagegroup ${WALLET} ${CID} + Should Contain ${ERR} ${PERMISSION_ERROR} + ${ERR} = Run Keyword And Expect Error * + ... Get Storagegroup ${WALLET} ${CID} ${SG} + Should Contain ${ERR} ${PERMISSION_ERROR} + ${ERR} = Run Keyword And Expect Error * + ... Delete Storagegroup ${WALLET} ${CID} ${SG} + Should Contain ${ERR} ${PERMISSION_ERROR} + + +Run Storage Group Operations With Bearer Token + [Arguments] ${WALLET} ${CID} ${OBJECTS} ${BEARER} ${OBJ_COMPLEXITY} + + ${SG} = Put Storagegroup ${WALLET} ${CID} ${OBJECTS} bearer_token=${BEARER} + Verify List Storage Group ${WALLET} ${CID} ${SG} ${BEARER} + Verify Get Storage Group ${WALLET} ${CID} ${SG} ${OBJECTS} ${OBJ_COMPLEXITY} ${BEARER} + Delete Storagegroup ${WALLET} ${CID} ${SG} bearer_token=${BEARER} + + +Run Storage Group Operations On Other's Behalf In RO Container + [Arguments] ${OWNER_WALLET} ${CID} ${OBJECTS} ${OBJ_COMPLEXITY} + [Documentation] ${OWNER_WALLET}: ${OBJECTS}' owner wallet + ... ${CID}: ID of read-only container + ... ${OBJECTS}: list of Object IDs to include into the Storage Group + ... ${OBJ_COMPLEXITY}: [Complex|Simple] + + ${OTHER_WALLET} ${_} ${_} = Prepare Wallet And Deposit + + ${SG} = Put Storagegroup ${OWNER_WALLET} ${CID} ${OBJECTS} + ${ERR} = Run Keyword And Expect Error * + ... Put Storagegroup ${OTHER_WALLET} ${CID} ${OBJECTS} + Should Contain ${ERR} ${PERMISSION_ERROR} + + Verify List Storage Group ${OTHER_WALLET} ${CID} ${SG} + Verify Get Storage Group ${OTHER_WALLET} ${CID} ${SG} ${OBJECTS} ${OBJ_COMPLEXITY} + + ${ERR} = Run Keyword And Expect Error * + ... Delete Storagegroup ${OTHER_WALLET} ${CID} ${SG} + Should Contain ${ERR} ${PERMISSION_ERROR} + + +Run Storage Group Operations On System's Behalf In RO Container + [Arguments] ${CID} ${OBJECTS} ${OBJ_COMPLEXITY} + [Documentation] ${CID}: ID of read-only container + ... ${OBJECTS}: list of Object IDs to include into the Storage Group + ... ${OBJ_COMPLEXITY}: [Complex|Simple] + ... + ... In this keyword we create Storage Group on Inner Ring's key behalf + ... and include an Object created on behalf of some user. We expect + ... that System key is granted to make all operations except DELETE. + + # TODO: get rid of WIF and remove `payment_operations.robot` import + ${IR_WALLET} ${_} = Prepare Wallet With WIF And Deposit ${NEOFS_IR_WIF} + + ${SG} = Put Storagegroup ${IR_WALLET} ${CID} ${OBJECTS} + Verify List Storage Group ${IR_WALLET} ${CID} ${SG} + Verify Get Storage Group ${IR_WALLET} ${CID} ${SG} ${OBJECTS} ${OBJ_COMPLEXITY} + ${ERR} = Run Keyword And Expect Error * + ... Delete Storagegroup ${IR_WALLET} ${CID} ${SG} + Should Contain ${ERR} ${PERMISSION_ERROR} + + +Verify List Storage Group + [Arguments] ${WALLET} ${CID} ${SG} ${BEARER}=${EMPTY} + + @{STORAGE_GROUPS} = List Storagegroup ${WALLET} ${CID} bearer_token=${BEARER} + List Should Contain Value ${STORAGE_GROUPS} ${SG} + ... msg="Storage Group hasn't been persisted" + + +Verify Get Storage Group + [Arguments] ${WALLET} ${CID} ${SG} ${OBJECTS} ${OBJ_COMPLEXITY} ${BEARER}=${EMPTY} + + @{PART_OIDS} = Create List + IF """${OBJ_COMPLEXITY}""" == """Complex""" + FOR ${OBJ} IN @{OBJECTS} + ${OIDS} = Get Object Parts By Link Object + ... ${WALLET} ${CID} ${OBJ} ${BEARER} + @{PART_OIDS} = Combine Lists ${PART_OIDS} ${OIDS} + END + END + + ${OBJECTS_NUMBER} = Get Length ${OBJECTS} + + &{SG_DATA} = Get Storagegroup ${WALLET} ${CID} ${SG} bearer_token=${BEARER} + + IF """${OBJ_COMPLEXITY}""" == """Simple""" + ${EXPECTED_SIZE} = Evaluate ${SIMPLE_OBJ_SIZE} * ${OBJECTS_NUMBER} + Should Be Equal As Numbers ${SG_DATA}[Group size] ${EXPECTED_SIZE} + Lists Should Be Equal ${SG_DATA}[Members] ${OBJECTS} + ELSE + ${EXPECTED_SIZE} = Evaluate ${COMPLEX_OBJ_SIZE} * ${OBJECTS_NUMBER} + Should Be Equal As Numbers ${SG_DATA}[Group size] ${EXPECTED_SIZE} + Lists Should Be Equal ${SG_DATA}[Members] ${PART_OIDS} + END diff --git a/robot/testsuites/integration/acl/acl_basic_private_container_storagegroup.robot b/robot/testsuites/integration/acl/acl_basic_private_container_storagegroup.robot index 29239a1..8a5b967 100644 --- a/robot/testsuites/integration/acl/acl_basic_private_container_storagegroup.robot +++ b/robot/testsuites/integration/acl/acl_basic_private_container_storagegroup.robot @@ -1,33 +1,35 @@ *** Settings *** Variables common.py +Library container.py Library neofs.py Library neofs_verbs.py Library payment_neogo.py +Library storage_group.py Library Collections -Resource common_steps_acl_basic.robot Resource payment_operations.robot Resource setup_teardown.robot -Resource complex_object_operations.robot +Resource storage_group.robot +Resource common_steps_acl_basic.robot *** Test cases *** Basic ACL Operations for Private Container - [Documentation] Testcase to validate NeoFS operations with ACL for Private Container. + [Documentation] Storage Group operations with Private Container. [Tags] ACL - [Timeout] 20 min + [Timeout] 10 min [Setup] Setup ${WALLET} ${_} ${_} = Prepare Wallet And Deposit ${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit - ${PRIV_CID} = Create Private Container ${WALLET} + ${PRIV_CID} = Create Container ${WALLET} ${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE} Check Private Container Simple ${WALLET} ${FILE_S} ${PRIV_CID} ${WALLET_OTH} - ${PRIV_CID} = Create Private Container ${WALLET} + ${PRIV_CID} = Create Container ${WALLET} ${FILE_S} ${_} = Generate file ${COMPLEX_OBJ_SIZE} Check Private Container Complex ${WALLET} ${FILE_S} ${PRIV_CID} ${WALLET_OTH} @@ -39,53 +41,18 @@ Basic ACL Operations for Private Container Check Private Container [Arguments] ${RUN_TYPE} ${USER_WALLET} ${FILE_S} ${PRIV_CID} ${OTHER_WALLET} - ${WALLET_SN} ${ADDR_SN} = Prepare Wallet with WIF And Deposit ${NEOFS_SN_WIF} ${WALLET_IR} ${ADDR_IR} = Prepare Wallet with WIF And Deposit ${NEOFS_IR_WIF} - # Put target object to use in storage groups - ${S_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${PRIV_CID} + ${OID} = Put object ${USER_WALLET} ${FILE_S} ${PRIV_CID} + @{OBJECTS} = Create List ${OID} + Run Storage Group Operations And Expect Success + ... ${USER_WALLET} ${PRIV_CID} ${OBJECTS} ${RUN_TYPE} - # Storage group Operations (Put, List, Get, Delete) with different Keys - # User group key - ${SG_OID_INV} = Put Storagegroup ${USER_WALLET} ${PRIV_CID} ${EMPTY} ${S_OID_USER} - ${SG_OID} = Put Storagegroup ${USER_WALLET} ${PRIV_CID} ${EMPTY} ${S_OID_USER} - List Storagegroup ${USER_WALLET} ${PRIV_CID} ${EMPTY} ${SG_OID} ${SG_OID_INV} - @{EXPECTED_OIDS} = Run Keyword If "${RUN_TYPE}" == "Complex" - ... Get Object Parts By Link Object ${USER_WALLET} ${PRIV_CID} ${S_OID_USER} - ... ELSE IF "${RUN_TYPE}" == "Simple" Create List ${S_OID_USER} - Get Storagegroup ${USER_WALLET} ${PRIV_CID} ${SG_OID} ${EMPTY} ${EMPTY} @{EXPECTED_OIDS} - Delete Storagegroup ${USER_WALLET} ${PRIV_CID} ${SG_OID} ${EMPTY} + Run Storage Group Operations And Expect Failure + ... ${OTHER_WALLET} ${PRIV_CID} ${OBJECTS} ${RUN_TYPE} - - # "Others" group key - Run Keyword And Expect Error * - ... Put Storagegroup ${OTHER_WALLET} ${PRIV_CID} ${EMPTY} ${S_OID_USER} - Run Keyword And Expect Error * - ... List Storagegroup ${OTHER_WALLET} ${PRIV_CID} ${EMPTY} ${SG_OID_INV} - Run Keyword And Expect Error * - ... Get Storagegroup ${OTHER_WALLET} ${PRIV_CID} ${SG_OID_INV} ${EMPTY} ${EMPTY} ${S_OID_USER} - Run Keyword And Expect Error * - ... Delete Storagegroup ${OTHER_WALLET} ${PRIV_CID} ${SG_OID_INV} ${EMPTY} - - - # System group key (Storage Node) - ${SG_OID_SN} = Put Storagegroup ${WALLET_SN} ${PRIV_CID} ${EMPTY} ${S_OID_USER} - List Storagegroup ${WALLET_SN} ${PRIV_CID} ${EMPTY} ${SG_OID_SN} ${SG_OID_INV} - @{EXPECTED_OIDS} = Run Keyword If "${RUN_TYPE}" == "Complex" - ... Get Object Parts By Link Object ${WALLET_SN} ${PRIV_CID} ${S_OID_USER} - ... ELSE IF "${RUN_TYPE}" == "Simple" Create List ${S_OID_USER} - Get Storagegroup ${WALLET_SN} ${PRIV_CID} ${SG_OID_SN} ${EMPTY} ${EMPTY} @{EXPECTED_OIDS} - Run Keyword And Expect Error * - ... Delete Storagegroup ${WALLET_SN} ${PRIV_CID} ${SG_OID_SN} ${EMPTY} - - - # System group key (Inner Ring Node) - ${SG_OID_IR} = Put Storagegroup ${WALLET_IR} ${PRIV_CID} ${EMPTY} ${S_OID_USER} - List Storagegroup ${WALLET_IR} ${PRIV_CID} ${EMPTY} ${SG_OID_SN} ${SG_OID_IR} ${SG_OID_INV} - @{EXPECTED_OIDS} = Run Keyword If "${RUN_TYPE}" == "Complex" - ... Get Object Parts By Link Object ${USER_WALLET} ${PRIV_CID} ${S_OID_USER} - ... ELSE IF "${RUN_TYPE}" == "Simple" Create List ${S_OID_USER} - Get Storagegroup ${WALLET_IR} ${PRIV_CID} ${SG_OID_IR} ${EMPTY} ${EMPTY} @{EXPECTED_OIDS} - Run Keyword And Expect Error * - ... Delete Storagegroup ${WALLET_IR} ${PRIV_CID} ${SG_OID_IR} ${EMPTY} + # In private container, Inner Ring is allowed to read (Storage Group List and Get), + # so using here keyword for read-only container. + Run Storage Group Operations On System's Behalf In RO Container + ... ${PRIV_CID} ${OBJECTS} ${RUN_TYPE} diff --git a/robot/testsuites/integration/acl/acl_basic_public_container_storagegroup.robot b/robot/testsuites/integration/acl/acl_basic_public_container_storagegroup.robot index f3098db..b5ed403 100644 --- a/robot/testsuites/integration/acl/acl_basic_public_container_storagegroup.robot +++ b/robot/testsuites/integration/acl/acl_basic_public_container_storagegroup.robot @@ -1,15 +1,16 @@ *** Settings *** Variables common.py -Library neofs.py -Library neofs_verbs.py -Library payment_neogo.py -Library contract_keywords.py +Library neofs.py +Library neofs_verbs.py +Library payment_neogo.py +Library contract_keywords.py +Library storage_group.py -Resource common_steps_acl_basic.robot -Resource payment_operations.robot -Resource setup_teardown.robot -Resource complex_object_operations.robot +Resource common_steps_acl_basic.robot +Resource payment_operations.robot +Resource setup_teardown.robot +Resource storage_group.robot *** Test cases *** @@ -39,37 +40,15 @@ Basic ACL Operations for Public Container Check Public Container [Arguments] ${RUN_TYPE} ${USER_WALLET} ${FILE_S} ${PUBLIC_CID} ${WALLET_OTH} - # Storage group Operations (Put, List, Get, Delete) - Log Storage group Operations for each Role keys + ${OID} = Put object ${USER_WALLET} ${FILE_S} ${PUBLIC_CID} + @{OBJECTS} = Create List ${OID} - # Put target object to use in storage groups - ${S_OID} = Put object ${USER_WALLET} ${FILE_S} ${PUBLIC_CID} + Run Storage Group Operations And Expect Success + ... ${USER_WALLET} ${PUBLIC_CID} ${OBJECTS} ${RUN_TYPE} - ${WALLET_SN} ${ADDR_SN} = Prepare Wallet with WIF And Deposit ${NEOFS_SN_WIF} - ${WALLET_IR} ${ADDR_IR} = Prepare Wallet with WIF And Deposit ${NEOFS_IR_WIF} - - @{ROLES_WALLETS_PASS} = Create List ${USER_WALLET} ${WALLET_OTH} - @{ROLES_WALLETS_SYS} = Create List ${WALLET_IR} ${WALLET_SN} - - FOR ${ROLE_WALLET} IN @{ROLES_WALLETS_PASS} - ${SG_OID_USERS} = Put Storagegroup ${ROLE_WALLET} ${PUBLIC_CID} ${EMPTY} ${S_OID} - List Storagegroup ${ROLE_WALLET} ${PUBLIC_CID} ${EMPTY} ${SG_OID_USERS} - @{EXPECTED_OIDS} = Run Keyword If "${RUN_TYPE}" == "Complex" - ... Get Object Parts By Link Object ${ROLE_WALLET} ${PUBLIC_CID} ${S_OID} - ... ELSE IF "${RUN_TYPE}" == "Simple" Create List ${S_OID} - Get Storagegroup ${ROLE_WALLET} ${PUBLIC_CID} ${SG_OID_USERS} ${EMPTY} ${EMPTY} @{EXPECTED_OIDS} - Delete Storagegroup ${ROLE_WALLET} ${PUBLIC_CID} ${SG_OID_USERS} ${EMPTY} - Tick Epoch - END - FOR ${ROLE_WALLET} IN @{ROLES_WALLETS_SYS} - ${SG_OID_SYS} = Put Storagegroup ${ROLE_WALLET} ${PUBLIC_CID} ${EMPTY} ${S_OID} - List Storagegroup ${ROLE_WALLET} ${PUBLIC_CID} ${EMPTY} ${SG_OID_SYS} - @{EXPECTED_OIDS} = Run Keyword If "${RUN_TYPE}" == "Complex" - ... Get Object Parts By Link Object ${ROLE_WALLET} ${PUBLIC_CID} ${S_OID} - ... ELSE IF "${RUN_TYPE}" == "Simple" Create List ${S_OID} - Get Storagegroup ${ROLE_WALLET} ${PUBLIC_CID} ${SG_OID_SYS} ${EMPTY} ${EMPTY} @{EXPECTED_OIDS} - Run Keyword And Expect Error * - ... Delete Storagegroup ${ROLE_WALLET} ${PUBLIC_CID} ${SG_OID_SYS} ${EMPTY} - Delete Storagegroup ${USER_WALLET} ${PUBLIC_CID} ${SG_OID_SYS} ${EMPTY} - Tick Epoch - END + Run Storage Group Operations And Expect Success + ... ${WALLET_OTH} ${PUBLIC_CID} ${OBJECTS} ${RUN_TYPE} + + # System isn't allowed to DELETE in Public Container + Run Storage Group Operations On System's Behalf In RO Container + ... ${PUBLIC_CID} ${OBJECTS} ${RUN_TYPE} diff --git a/robot/testsuites/integration/acl/acl_basic_readonly_container.robot b/robot/testsuites/integration/acl/acl_basic_readonly_container.robot index 124ffbe..0d58063 100644 --- a/robot/testsuites/integration/acl/acl_basic_readonly_container.robot +++ b/robot/testsuites/integration/acl/acl_basic_readonly_container.robot @@ -1,14 +1,13 @@ *** Settings *** Variables common.py -Library neofs.py -Library neofs_verbs.py -Library payment_neogo.py +Library neofs.py +Library neofs_verbs.py +Library payment_neogo.py -Resource common_steps_acl_basic.robot -Resource payment_operations.robot -Resource setup_teardown.robot -Resource complex_object_operations.robot +Resource common_steps_acl_basic.robot +Resource payment_operations.robot +Resource setup_teardown.robot *** Test cases *** @@ -38,8 +37,8 @@ Basic ACL Operations for Read-Only Container Check Read-Only Container [Arguments] ${RUN_TYPE} ${USER_WALLET} ${FILE_S} ${READONLY_CID} ${WALLET_OTH} - ${WALLET_SN} ${ADDR_SN} = Prepare Wallet with WIF And Deposit ${NEOFS_SN_WIF} - ${WALLET_IR} ${ADDR_IR} = Prepare Wallet with WIF And Deposit ${NEOFS_IR_WIF} + ${WALLET_SN} ${_} = Prepare Wallet with WIF And Deposit ${NEOFS_SN_WIF} + ${WALLET_IR} ${_} = Prepare Wallet with WIF And Deposit ${NEOFS_IR_WIF} # Put ${S_OID_USER} = Put Object ${USER_WALLET} ${FILE_S} ${READONLY_CID} @@ -48,36 +47,6 @@ Check Read-Only Container ${S_OID_SYS_IR} = Put Object ${WALLET_IR} ${FILE_S} ${READONLY_CID} ${S_OID_SYS_SN} = Put object ${WALLET_SN} ${FILE_S} ${READONLY_CID} - - # Storage group Operations (Put, List, Get, Delete) - ${SG_OID_INV} = Put Storagegroup ${USER_WALLET} ${READONLY_CID} ${EMPTY} ${S_OID_USER} - ${SG_OID_1} = Put Storagegroup ${USER_WALLET} ${READONLY_CID} ${EMPTY} ${S_OID_USER} - List Storagegroup ${USER_WALLET} ${READONLY_CID} ${EMPTY} ${SG_OID_1} ${SG_OID_INV} - @{EXPECTED_OIDS} = Run Keyword If "${RUN_TYPE}" == "Complex" - ... Get Object Parts By Link Object ${USER_WALLET} ${READONLY_CID} ${S_OID_USER} - ... ELSE IF "${RUN_TYPE}" == "Simple" Create List ${S_OID_USER} - Get Storagegroup ${USER_WALLET} ${READONLY_CID} ${SG_OID_1} ${EMPTY} ${EMPTY} @{EXPECTED_OIDS} - Delete Storagegroup ${USER_WALLET} ${READONLY_CID} ${SG_OID_1} ${EMPTY} - - Run Keyword And Expect Error * - ... Put Storagegroup ${WALLET_OTH} ${READONLY_CID} ${EMPTY} ${S_OID_USER} - List Storagegroup ${WALLET_OTH} ${READONLY_CID} ${EMPTY} ${SG_OID_INV} - @{EXPECTED_OIDS} = Run Keyword If "${RUN_TYPE}" == "Complex" - ... Get Object Parts By Link Object ${USER_WALLET} ${READONLY_CID} ${S_OID_USER} - ... ELSE IF "${RUN_TYPE}" == "Simple" Create List ${S_OID_USER} - Get Storagegroup ${WALLET_OTH} ${READONLY_CID} ${SG_OID_INV} ${EMPTY} ${EMPTY} @{EXPECTED_OIDS} - Run Keyword And Expect Error * - ... Delete Storagegroup ${WALLET_OTH} ${READONLY_CID} ${SG_OID_INV} ${EMPTY} - - ${SG_OID_IR} = Put Storagegroup ${WALLET_IR} ${READONLY_CID} ${EMPTY} ${S_OID_USER} - List Storagegroup ${WALLET_IR} ${READONLY_CID} ${EMPTY} ${SG_OID_INV} ${SG_OID_IR} - @{EXPECTED_OIDS} = Run Keyword If "${RUN_TYPE}" == "Complex" - ... Get Object Parts By Link Object ${USER_WALLET} ${READONLY_CID} ${S_OID_USER} - ... ELSE IF "${RUN_TYPE}" == "Simple" Create List ${S_OID_USER} - Get Storagegroup ${WALLET_IR} ${READONLY_CID} ${SG_OID_IR} ${EMPTY} ${EMPTY} @{EXPECTED_OIDS} - Run Keyword And Expect Error * - ... Delete Storagegroup ${WALLET_IR} ${READONLY_CID} ${SG_OID_IR} ${EMPTY} - # Get Get object ${USER_WALLET} ${READONLY_CID} ${S_OID_USER} ${EMPTY} s_file_read Get Object ${WALLET_OTH} ${READONLY_CID} ${S_OID_USER} ${EMPTY} s_file_read diff --git a/robot/testsuites/integration/acl/acl_basic_readonly_container_storagegroup.robot b/robot/testsuites/integration/acl/acl_basic_readonly_container_storagegroup.robot index 6641e8e..739a9cb 100644 --- a/robot/testsuites/integration/acl/acl_basic_readonly_container_storagegroup.robot +++ b/robot/testsuites/integration/acl/acl_basic_readonly_container_storagegroup.robot @@ -1,14 +1,15 @@ *** Settings *** Variables common.py -Library neofs.py -Library neofs_verbs.py -Library payment_neogo.py +Library neofs.py +Library neofs_verbs.py +Library payment_neogo.py +Library storage_group.py -Resource common_steps_acl_basic.robot -Resource payment_operations.robot -Resource setup_teardown.robot -Resource complex_object_operations.robot +Resource common_steps_acl_basic.robot +Resource payment_operations.robot +Resource setup_teardown.robot +Resource storage_group.robot *** Test cases *** @@ -19,8 +20,8 @@ Basic ACL Operations for Read-Only Container [Setup] Setup - ${WALLET} ${_} ${_} = Prepare Wallet And Deposit - ${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit + ${WALLET} ${_} ${_} = Prepare Wallet And Deposit + ${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit ${READONLY_CID} = Create Read-Only Container ${WALLET} ${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE} @@ -37,41 +38,20 @@ Basic ACL Operations for Read-Only Container Check Read-Only Container - [Arguments] ${RUN_TYPE} ${USER_WALLET} ${FILE_S} ${READONLY_CID} ${WALLET_OTH} + [Arguments] ${RUN_TYPE} ${USER_WALLET} ${FILE} ${READONLY_CID} ${WALLET_OTH} ${WALLET_IR} ${ADDR_IR} = Prepare Wallet with WIF And Deposit ${NEOFS_IR_WIF} - # Put target object to use in storage groups - ${S_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${READONLY_CID} + ${OID} = Put object ${USER_WALLET} ${FILE} ${READONLY_CID} + @{OBJECTS} = Create List ${OID} - # Storage group Operations (Put, List, Get, Delete) for Read-only container + ${SG_1} = Put Storagegroup ${USER_WALLET} ${READONLY_CID} ${OBJECTS} - ${SG_OID_INV} = Put Storagegroup ${USER_WALLET} ${READONLY_CID} ${EMPTY} ${S_OID_USER} - ${SG_OID_1} = Put Storagegroup ${USER_WALLET} ${READONLY_CID} ${EMPTY} ${S_OID_USER} - List Storagegroup ${USER_WALLET} ${READONLY_CID} ${EMPTY} ${SG_OID_1} ${SG_OID_INV} - @{EXPECTED_OIDS} = Run Keyword If "${RUN_TYPE}" == "Complex" - ... Get Object Parts By Link Object ${USER_WALLET} ${READONLY_CID} ${S_OID_USER} - ... ELSE IF "${RUN_TYPE}" == "Simple" Create List ${S_OID_USER} - Get Storagegroup ${USER_WALLET} ${READONLY_CID} ${SG_OID_1} ${EMPTY} ${EMPTY} @{EXPECTED_OIDS} - Delete Storagegroup ${USER_WALLET} ${READONLY_CID} ${SG_OID_1} ${EMPTY} + Run Storage Group Operations And Expect Success + ... ${USER_WALLET} ${READONLY_CID} ${OBJECTS} ${RUN_TYPE} + Run Storage Group Operations On Other's Behalf in RO Container + ... ${USER_WALLET} ${READONLY_CID} ${OBJECTS} ${RUN_TYPE} - Run Keyword And Expect Error * - ... Put Storagegroup ${WALLET_OTH} ${READONLY_CID} ${EMPTY} ${S_OID_USER} - List Storagegroup ${WALLET_OTH} ${READONLY_CID} ${EMPTY} ${SG_OID_INV} - @{EXPECTED_OIDS} = Run Keyword If "${RUN_TYPE}" == "Complex" - ... Get Object Parts By Link Object ${USER_WALLET} ${READONLY_CID} ${S_OID_USER} - ... ELSE IF "${RUN_TYPE}" == "Simple" Create List ${S_OID_USER} - Get Storagegroup ${WALLET_OTH} ${READONLY_CID} ${SG_OID_INV} ${EMPTY} ${EMPTY} @{EXPECTED_OIDS} - Run Keyword And Expect Error * - ... Delete Storagegroup ${WALLET_OTH} ${READONLY_CID} ${SG_OID_INV} ${EMPTY} - - - ${SG_OID_IR} = Put Storagegroup ${WALLET_IR} ${READONLY_CID} ${EMPTY} ${S_OID_USER} - List Storagegroup ${WALLET_IR} ${READONLY_CID} ${EMPTY} ${SG_OID_INV} ${SG_OID_IR} - @{EXPECTED_OIDS} = Run Keyword If "${RUN_TYPE}" == "Complex" - ... Get Object Parts By Link Object ${USER_WALLET} ${READONLY_CID} ${S_OID_USER} - ... ELSE IF "${RUN_TYPE}" == "Simple" Create List ${S_OID_USER} - Get Storagegroup ${WALLET_IR} ${READONLY_CID} ${SG_OID_IR} ${EMPTY} ${EMPTY} @{EXPECTED_OIDS} - Run Keyword And Expect Error * - ... Delete Storagegroup ${WALLET_IR} ${READONLY_CID} ${SG_OID_INV} ${EMPTY} + Run Storage Group Operations On System's Behalf in RO Container + ... ${READONLY_CID} ${OBJECTS} ${RUN_TYPE} diff --git a/robot/testsuites/integration/acl/acl_bearer_allow_storagegroup.robot b/robot/testsuites/integration/acl/acl_bearer_allow_storagegroup.robot index 4649792..d6b9a49 100644 --- a/robot/testsuites/integration/acl/acl_bearer_allow_storagegroup.robot +++ b/robot/testsuites/integration/acl/acl_bearer_allow_storagegroup.robot @@ -5,13 +5,12 @@ Library Collections Library acl.py Library neofs.py Library neofs_verbs.py -Library payment_neogo.py -Resource eacl_tables.robot Resource common_steps_acl_bearer.robot +Resource eacl_tables.robot Resource payment_operations.robot Resource setup_teardown.robot -Resource complex_object_operations.robot +Resource storage_group.robot *** Test cases *** @@ -24,15 +23,12 @@ BearerToken Operations ${WALLET} ${_} ${_} = Prepare Wallet And Deposit - Log Check Bearer token with simple object ${FILE_S} = Generate file ${SIMPLE_OBJ_SIZE} Check eACL Deny and Allow All Bearer Simple ${WALLET} ${FILE_S} - Log Check Bearer token with complex object ${FILE_S} = Generate file ${COMPLEX_OBJ_SIZE} Check eACL Deny and Allow All Bearer Complex ${WALLET} ${FILE_S} - [Teardown] Teardown acl_bearer_allow_storagegroup @@ -40,52 +36,36 @@ BearerToken Operations *** Keywords *** Check eACL Deny and Allow All Bearer - [Arguments] ${RUN_TYPE} ${WALLET} ${FILE_S} + [Arguments] ${RUN_TYPE} ${WALLET} ${FILE_S} - ${CID} = Create Container Public ${WALLET} - ${S_OID_USER} = Put object ${WALLET} ${FILE_S} ${CID} - Prepare eACL Role rules ${CID} + ${CID} = Create Container Public ${WALLET} + ${OID} = Put object ${WALLET} ${FILE_S} ${CID} + @{OBJECTS} = Create List ${OID} + Run Storage Group Operations and Expect Success + ... ${WALLET} ${CID} ${OBJECTS} ${RUN_TYPE} - # Storage group Operations (Put, List, Get, Delete) - ${SG_OID_INV} = Put Storagegroup ${WALLET} ${CID} ${EMPTY} ${S_OID_USER} - ${SG_OID_1} = Put Storagegroup ${WALLET} ${CID} ${EMPTY} ${S_OID_USER} - List Storagegroup ${WALLET} ${CID} ${EMPTY} ${SG_OID_1} ${SG_OID_INV} - @{EXPECTED_OIDS} = Run Keyword If "${RUN_TYPE}" == "Complex" - ... Get Object Parts By Link Object ${WALLET} ${CID} ${S_OID_USER} - ... ELSE IF "${RUN_TYPE}" == "Simple" Create List ${S_OID_USER} - Get Storagegroup ${WALLET} ${CID} ${SG_OID_1} ${EMPTY} ${EMPTY} @{EXPECTED_OIDS} - Delete Storagegroup ${WALLET} ${CID} ${SG_OID_1} ${EMPTY} + ${SG} = Put Storagegroup ${WALLET} ${CID} ${OBJECTS} + Prepare eACL Role rules ${CID} Set eACL ${WALLET} ${CID} ${EACL_DENY_ALL_USER} - # The current ACL cache lifetime is 30 sec - Sleep ${NEOFS_CONTRACT_CACHE_TIMEOUT} + Run Storage Group Operations and Expect Failure + ... ${WALLET} ${CID} ${OBJECTS} ${SG} - ${rule1}= Create Dictionary Operation=GET Access=ALLOW Role=USER - ${rule2}= Create Dictionary Operation=HEAD Access=ALLOW Role=USER - ${rule3}= Create Dictionary Operation=PUT Access=ALLOW Role=USER - ${rule4}= Create Dictionary Operation=DELETE Access=ALLOW Role=USER - ${rule5}= Create Dictionary Operation=SEARCH Access=ALLOW Role=USER - ${rule6}= Create Dictionary Operation=GETRANGE Access=ALLOW Role=USER - ${rule7}= Create Dictionary Operation=GETRANGEHASH Access=ALLOW Role=USER - - ${eACL_gen}= Create List ${rule1} ${rule2} ${rule3} ${rule4} ${rule5} ${rule6} ${rule7} + ${RULE_GET} = Create Dictionary Operation=GET Access=ALLOW Role=USER + ${RULE_HEAD} = Create Dictionary Operation=HEAD Access=ALLOW Role=USER + ${RULE_PUT} = Create Dictionary Operation=PUT Access=ALLOW Role=USER + ${RULE_DELETE} = Create Dictionary Operation=DELETE Access=ALLOW Role=USER + ${RULE_SEARCH} = Create Dictionary Operation=SEARCH Access=ALLOW Role=USER + ${eACL_gen}= Create List + ... ${RULE_GET} + ... ${RULE_HEAD} + ... ${RULE_PUT} + ... ${RULE_DELETE} + ... ${RULE_SEARCH} ${EACL_TOKEN} = Form BearerToken File ${WALLET} ${CID} ${eACL_gen} - # All storage groups should fail without bearer token - Run Keyword And Expect Error * - ... Put Storagegroup ${WALLET} ${CID} ${EMPTY} ${S_OID_USER} - Run Keyword And Expect Error * - ... List Storagegroup ${WALLET} ${CID} ${EMPTY} ${SG_OID_1} ${SG_OID_INV} - Run Keyword And Expect Error * - ... Get Storagegroup ${WALLET} ${CID} ${SG_OID_1} ${EMPTY} ${EMPTY} @{EXPECTED_OIDS} - Run Keyword And Expect Error * - ... Delete Storagegroup ${WALLET} ${CID} ${SG_OID_1} ${EMPTY} - - # Storagegroup should passed with User group key and bearer token - ${SG_OID_NEW} = Put Storagegroup ${WALLET} ${CID} ${EACL_TOKEN} ${S_OID_USER} - List Storagegroup ${WALLET} ${CID} ${EACL_TOKEN} ${SG_OID_NEW} ${SG_OID_INV} - Get Storagegroup ${WALLET} ${CID} ${SG_OID_INV} ${EACL_TOKEN} ${EMPTY} @{EXPECTED_OIDS} - Delete Storagegroup ${WALLET} ${CID} ${SG_OID_INV} ${EACL_TOKEN} + Run Storage Group Operations With Bearer Token + ... ${WALLET} ${CID} ${OBJECTS} ${EACL_TOKEN} ${RUN_TYPE} diff --git a/robot/testsuites/integration/object/object_storagegroup_complex.robot b/robot/testsuites/integration/object/object_storagegroup_complex.robot index f57ffae..c4a1765 100644 --- a/robot/testsuites/integration/object/object_storagegroup_complex.robot +++ b/robot/testsuites/integration/object/object_storagegroup_complex.robot @@ -3,17 +3,16 @@ Variables common.py Library neofs.py Library neofs_verbs.py -Library payment_neogo.py +Library storage_group.py Library Collections Resource common_steps_object.robot Resource setup_teardown.robot Resource payment_operations.robot -Resource complex_object_operations.robot +Resource storage_group.robot *** Variables *** -${UNEXIST_OID} = B2DKvkHnLnPvapbDgfpU1oVUPuXQo5LTfKVxmNDZXQff -&{USER_HEADER} = key1=1 key2=2 +@{UNEXIST_OID} = B2DKvkHnLnPvapbDgfpU1oVUPuXQo5LTfKVxmNDZXQff *** Test cases *** NeoFS Complex Storagegroup @@ -23,47 +22,26 @@ NeoFS Complex Storagegroup [Setup] Setup - ${WALLET} ${ADDR} ${WIF} = Prepare Wallet And Deposit - ${CID} = Prepare container ${WIF} ${WALLET} + ${WALLET} ${_} ${WIF} = Prepare Wallet And Deposit + ${CID} = Prepare container ${WIF} ${WALLET} - ${FILE_S} = Generate file of bytes ${COMPLEX_OBJ_SIZE} - ${FILE_HASH_S} = Get file hash ${FILE_S} + ${FILE} = Generate file of bytes ${COMPLEX_OBJ_SIZE} - # Put two Simple Object - ${S_OID_1} = Put object ${WALLET} ${FILE_S} ${CID} - ${S_OID_2} = Put object ${WALLET} ${FILE_S} ${CID} user_headers=&{USER_HEADER} + ${OID_1} = Put object ${WALLET} ${FILE} ${CID} + ${OID_2} = Put object ${WALLET} ${FILE} ${CID} - @{S_OBJ_ALL} = Create List ${S_OID_1} ${S_OID_2} + @{ONE_OBJECT} = Create List ${OID_1} + @{TWO_OBJECTS} = Create List ${OID_1} ${OID_2} - Log Storage group with 1 object - ${SG_OID_1} = Put Storagegroup ${WALLET} ${CID} ${EMPTY} ${S_OID_1} - List Storagegroup ${WALLET} ${CID} ${EMPTY} ${SG_OID_1} - @{SPLIT_OBJ_1} = Get Object Parts By Link Object ${WALLET} ${CID} ${S_OID_1} - Get Storagegroup ${WALLET} ${CID} ${SG_OID_1} ${EMPTY} ${COMPLEX_OBJ_SIZE} @{SPLIT_OBJ_1} - ${Tombstone} = Delete Storagegroup ${WALLET} ${CID} ${SG_OID_1} ${EMPTY} - Verify Head tombstone ${WALLET} ${CID} ${Tombstone} ${SG_OID_1} ${ADDR} - Run Keyword And Expect Error * - ... Get Storagegroup ${WALLET} ${CID} ${SG_OID_1} ${EMPTY} ${COMPLEX_OBJ_SIZE} @{SPLIT_OBJ_1} - List Storagegroup ${WALLET} ${CID} ${EMPTY} @{EMPTY} + Run Storage Group Operations And Expect Success + ... ${WALLET} ${CID} ${ONE_OBJECT} Complex - Log Storage group with 2 objects - ${SG_OID_2} = Put Storagegroup ${WALLET} ${CID} ${EMPTY} @{S_OBJ_ALL} - List Storagegroup ${WALLET} ${CID} ${EMPTY} ${SG_OID_2} - @{SPLIT_OBJ_2} = Get Object Parts By Link Object ${WALLET} ${CID} ${S_OID_2} - @{SPLIT_OBJ_ALL} = Combine Lists ${SPLIT_OBJ_1} ${SPLIT_OBJ_2} - ${EXPECTED_SIZE} = Evaluate 2*${COMPLEX_OBJ_SIZE} - Get Storagegroup ${WALLET} ${CID} ${SG_OID_2} ${EMPTY} ${EXPECTED_SIZE} @{SPLIT_OBJ_ALL} - ${Tombstone} = Delete Storagegroup ${WALLET} ${CID} ${SG_OID_2} ${EMPTY} - Verify Head tombstone ${WALLET} ${CID} ${Tombstone} ${SG_OID_2} ${ADDR} - Run Keyword And Expect Error * - ... Get Storagegroup ${WALLET} ${CID} ${SG_OID_2} ${EMPTY} ${EXPECTED_SIZE} @{SPLIT_OBJ_ALL} - List Storagegroup ${WALLET} ${CID} ${EMPTY} @{EMPTY} - - Log Incorrect input + Run Storage Group Operations And Expect Success + ... ${WALLET} ${CID} ${TWO_OBJECTS} Complex Run Keyword And Expect Error * - ... Put Storagegroup ${WALLET} ${CID} ${EMPTY} ${UNEXIST_OID} + ... Put Storagegroup ${WALLET} ${CID} ${UNEXIST_OID} Run Keyword And Expect Error * - ... Delete Storagegroup ${WALLET} ${CID} ${UNEXIST_OID} ${EMPTY} + ... Delete Storagegroup ${WALLET} ${CID} ${UNEXIST_OID} [Teardown] Teardown object_storage_group_complex diff --git a/robot/testsuites/integration/object/object_storagegroup_simple.robot b/robot/testsuites/integration/object/object_storagegroup_simple.robot index ab3dddb..8f6c0be 100644 --- a/robot/testsuites/integration/object/object_storagegroup_simple.robot +++ b/robot/testsuites/integration/object/object_storagegroup_simple.robot @@ -4,63 +4,44 @@ Variables common.py Library neofs.py Library neofs_verbs.py Library payment_neogo.py +Library storage_group.py Resource common_steps_object.robot Resource setup_teardown.robot Resource payment_operations.robot +Resource storage_group.robot *** Variables *** -${UNEXIST_OID} = B2DKvkHnLnPvapbDgfpU1oVUPuXQo5LTfKVxmNDZXQff -&{USER_HEADER} = key1=1 key2=2 +@{UNEXIST_OID} = B2DKvkHnLnPvapbDgfpU1oVUPuXQo5LTfKVxmNDZXQff *** Test cases *** NeoFS Simple Storagegroup [Documentation] Testcase to validate NeoFS operations with Storagegroup. - [Tags] Object NeoFS NeoCLI + [Tags] Object [Timeout] 20 min [Setup] Setup - ${WALLET} ${ADDR} ${WIF} = Prepare Wallet And Deposit - ${CID} = Prepare container ${WIF} ${WALLET} + ${WALLET} ${_} ${WIF} = Prepare Wallet And Deposit + ${CID} = Prepare container ${WIF} ${WALLET} ${FILE_S} = Generate file of bytes ${SIMPLE_OBJ_SIZE} - ${FILE_HASH_S} = Get file hash ${FILE_S} + ${OID_1} = Put object ${WALLET} ${FILE_S} ${CID} + ${OID_2} = Put object ${WALLET} ${FILE_S} ${CID} - # Put two Simple Object - ${S_OID_1} = Put object ${WALLET} ${FILE_S} ${CID} - ${S_OID_2} = Put object ${WALLET} ${FILE_S} ${CID} user_headers=&{USER_HEADER} + @{ONE_OBJECT} = Create List ${OID_1} + @{TWO_OBJECTS} = Create List ${OID_1} ${OID_2} - @{S_OBJ_ALL} = Create List ${S_OID_1} ${S_OID_2} + Run Storage Group Operations And Expect Success + ... ${WALLET} ${CID} ${ONE_OBJECT} Simple - Log Storage group with 1 object - ${SG_OID_1} = Put Storagegroup ${WALLET} ${CID} ${EMPTY} ${S_OID_1} - List Storagegroup ${WALLET} ${CID} ${EMPTY} ${SG_OID_1} - Get Storagegroup ${WALLET} ${CID} ${SG_OID_1} ${EMPTY} ${SIMPLE_OBJ_SIZE} ${S_OID_1} - ${Tombstone} = Delete Storagegroup ${WALLET} ${CID} ${SG_OID_1} ${EMPTY} - Verify Head tombstone ${WALLET} ${CID} ${Tombstone} ${SG_OID_1} ${ADDR} - Run Keyword And Expect Error * - ... Get Storagegroup ${WALLET} ${CID} ${SG_OID_1} ${EMPTY} ${SIMPLE_OBJ_SIZE} ${S_OID_1} - List Storagegroup ${WALLET} ${CID} ${EMPTY} @{EMPTY} - - - Log Storage group with 2 objects - ${SG_OID_2} = Put Storagegroup ${WALLET} ${CID} ${EMPTY} @{S_OBJ_ALL} - List Storagegroup ${WALLET} ${CID} ${EMPTY} ${SG_OID_2} - ${EXPECTED_SIZE} = Evaluate 2*${SIMPLE_OBJ_SIZE} - Get Storagegroup ${WALLET} ${CID} ${SG_OID_2} ${EMPTY} ${EXPECTED_SIZE} @{S_OBJ_ALL} - ${Tombstone} = Delete Storagegroup ${WALLET} ${CID} ${SG_OID_2} ${EMPTY} - Verify Head tombstone ${WALLET} ${CID} ${Tombstone} ${SG_OID_2} ${ADDR} - Run Keyword And Expect Error * - ... Get Storagegroup ${WALLET} ${CID} ${SG_OID_2} ${EMPTY} ${EXPECTED_SIZE} @{S_OBJ_ALL} - List Storagegroup ${WALLET} ${CID} ${EMPTY} @{EMPTY} - - Log Incorrect input + Run Storage Group Operations And Expect Success + ... ${WALLET} ${CID} ${TWO_OBJECTS} Simple Run Keyword And Expect Error * - ... Put Storagegroup ${WALLET} ${CID} ${EMPTY} ${UNEXIST_OID} + ... Put Storagegroup ${WALLET} ${CID} ${UNEXIST_OID} Run Keyword And Expect Error * - ... Delete Storagegroup ${WALLET} ${CID} ${UNEXIST_OID} ${EMPTY} + ... Delete Storagegroup ${WALLET} ${CID} ${UNEXIST_OID} [Teardown] Teardown object_storage_group_simple diff --git a/robot/variables/common.py b/robot/variables/common.py index 93c57a8..d350d58 100644 --- a/robot/variables/common.py +++ b/robot/variables/common.py @@ -11,8 +11,8 @@ CONTAINER_WAIT_INTERVAL = "1m" NEOFS_EPOCH_TIMEOUT = (os.getenv("NEOFS_EPOCH_TIMEOUT") if os.getenv("NEOFS_EPOCH_TIMEOUT") else os.getenv("NEOFS_IR_TIMERS_EPOCH", "300s")) -SIMPLE_OBJ_SIZE = os.getenv("SIMPLE_OBJ_SIZE", "1000") -COMPLEX_OBJ_SIZE = os.getenv("COMPLEX_OBJ_SIZE", "2000") +SIMPLE_OBJ_SIZE = "1000" +COMPLEX_OBJ_SIZE = "2000" MAINNET_BLOCK_TIME = os.getenv('MAINNET_BLOCK_TIME', "1s") MAINNET_TIMEOUT = os.getenv('MAINNET_TIMEOUT', "1min")