[#271] fixed key for eacl filter test

Signed-off-by: anastasia prasolova <anastasia@nspcc.ru>
This commit is contained in:
anastasia prasolova 2022-08-03 15:20:29 +03:00 committed by Anastasia Prasolova
parent bebbc42187
commit dd98eb3d9d
5 changed files with 60 additions and 66 deletions

View file

@ -80,6 +80,10 @@ def create_eacl(cid: str, rules_list: list):
) )
_cmd_run(cmd) _cmd_run(cmd)
with open(table, 'r') as fout:
table_data = fout.read()
logger.info(f"Generated eACL:\n{table_data}")
return table return table

View file

@ -88,7 +88,7 @@ def _configure_aws_cli(cmd: str, key_id: str, access_key: str, out_format: str =
def _attach_allure_log(cmd: str, output: str, return_code: int, start_time: datetime, def _attach_allure_log(cmd: str, output: str, return_code: int, start_time: datetime,
end_time: datetime) -> None: end_time: datetime) -> None:
if 'allure' in sys.modules: if 'robot' not in sys.modules:
command_attachment = ( command_attachment = (
f"COMMAND: '{cmd}'\n" f"COMMAND: '{cmd}'\n"
f'OUTPUT:\n {output}\n' f'OUTPUT:\n {output}\n'
@ -101,7 +101,7 @@ def _attach_allure_log(cmd: str, output: str, return_code: int, start_time: date
def log_command_execution(cmd: str, output: Union[str, dict]) -> None: def log_command_execution(cmd: str, output: Union[str, dict]) -> None:
logger.info(f'{cmd}: {output}') logger.info(f'{cmd}: {output}')
if 'allure' in sys.modules: if 'robot' not in sys.modules:
with suppress(Exception): with suppress(Exception):
json_output = json.dumps(output, indent=4, sort_keys=True) json_output = json.dumps(output, indent=4, sort_keys=True)
output = json_output output = json_output

View file

@ -1,18 +0,0 @@
*** Settings ***
Variables common.py
Library OperatingSystem
Library utility_keywords.py
*** Keywords ***
Setup
[Arguments]
Make Up
Create Directory ${ASSETS_DIR}
Teardown
[Arguments] ${LOGFILE}
Remove Directory ${ASSETS_DIR} True
Get Docker Logs ${LOGFILE}
Make Down

View file

@ -14,12 +14,13 @@ Resource payment_operations.robot
&{USER_HEADER} = key1=1 key2=abc &{USER_HEADER} = key1=1 key2=abc
&{USER_HEADER_DEL} = key1=del key2=del &{USER_HEADER_DEL} = key1=del key2=del
&{ANOTHER_HEADER} = key1=oth key2=oth &{ANOTHER_HEADER} = key1=oth key2=oth
${ERROR} = code = 2048 message = access to object operation denied
*** Test cases *** *** Test cases ***
BearerToken Operations BearerToken Operations
[Documentation] Testcase to validate NeoFS operations with BearerToken. [Documentation] Testcase to validate NeoFS operations with BearerToken.
[Tags] ACL BearerToken [Tags] ACL BearerToken
[Timeout] 20 min [Timeout] 1 min
${WALLET} ${_} ${_} = Prepare Wallet And Deposit ${WALLET} ${_} ${_} = Prepare Wallet And Deposit
@ -62,23 +63,31 @@ Check eACL Allow All Bearer Filter Requst Equal Deny
Put object ${WALLET} ${FILE_S} ${CID} bearer=${EACL_TOKEN} user_headers=${ANOTHER_HEADER} options=--xhdr a=2 Put object ${WALLET} ${FILE_S} ${CID} bearer=${EACL_TOKEN} user_headers=${ANOTHER_HEADER} options=--xhdr a=2
Get object ${WALLET} ${CID} ${S_OID_USER} ${EACL_TOKEN} local_file_eacl ${EMPTY} --xhdr a=2 Get object ${WALLET} ${CID} ${S_OID_USER} ${EACL_TOKEN} local_file_eacl ${EMPTY} --xhdr a=2
Search object ${WALLET} ${CID} ${EMPTY} ${EACL_TOKEN} ${USER_HEADER} ${S_OBJ_H} options=--xhdr a=2 Search object ${WALLET} ${CID} bearer=${EACL_TOKEN} filters=${USER_HEADER}
... expected_objects_list=${S_OBJ_H} options=--xhdr a=2
Head object ${WALLET} ${CID} ${S_OID_USER} bearer_token=${EACL_TOKEN} options=--xhdr a=2 Head object ${WALLET} ${CID} ${S_OID_USER} bearer_token=${EACL_TOKEN} options=--xhdr a=2
Get Range ${WALLET} ${CID} ${S_OID_USER} 0:256 bearer=${EACL_TOKEN} options=--xhdr a=2 Get Range ${WALLET} ${CID} ${S_OID_USER} 0:256 bearer=${EACL_TOKEN} options=--xhdr a=2
Get Range Hash ${WALLET} ${CID} ${S_OID_USER} ${EACL_TOKEN} 0:256 options=--xhdr a=2 Get Range Hash ${WALLET} ${CID} ${S_OID_USER} ${EACL_TOKEN} 0:256 options=--xhdr a=2
Delete object ${WALLET} ${CID} ${D_OID_USER} bearer=${EACL_TOKEN} options=--xhdr a=2 Delete object ${WALLET} ${CID} ${D_OID_USER} bearer=${EACL_TOKEN} options=--xhdr a=2
Run Keyword And Expect Error * ${ERR} = Run Keyword And Expect Error *
... Put object ${WALLET} ${FILE_S} ${CID} bearer=${EACL_TOKEN} user_headers=${USER_HEADER} options=--xhdr a=256 ... Put object ${WALLET} ${FILE_S} ${CID} bearer=${EACL_TOKEN} user_headers=${USER_HEADER} options=--xhdr a=256
Run Keyword And Expect Error * Should Contain ${ERR} ${ERROR}
${ERR} = Run Keyword And Expect Error *
... Get object ${WALLET} ${CID} ${S_OID_USER} ${EACL_TOKEN} local_file_eacl ${EMPTY} --xhdr a=256 ... Get object ${WALLET} ${CID} ${S_OID_USER} ${EACL_TOKEN} local_file_eacl ${EMPTY} --xhdr a=256
Run Keyword And Expect Error * Should Contain ${ERR} ${ERROR}
... Search object ${WALLET} ${CID} ${EMPTY} ${EACL_TOKEN} ${USER_HEADER} ${EMPTY} --xhdr a=256 ${ERR} = Run Keyword And Expect Error *
Run Keyword And Expect Error * ... Search object ${WALLET} ${CID} bearer=${EACL_TOKEN} filters=${USER_HEADER} options=--xhdr a=256
Should Contain ${ERR} ${ERROR}
${ERR} = Run Keyword And Expect Error *
... Head object ${WALLET} ${CID} ${S_OID_USER} bearer_token=${EACL_TOKEN} options=--xhdr a=256 ... Head object ${WALLET} ${CID} ${S_OID_USER} bearer_token=${EACL_TOKEN} options=--xhdr a=256
Run Keyword And Expect Error * Should Contain ${ERR} ${ERROR}
${ERR} = Run Keyword And Expect Error *
... Get Range ${WALLET} ${CID} ${S_OID_USER} 0:256 bearer=${EACL_TOKEN} options=--xhdr a=256 ... Get Range ${WALLET} ${CID} ${S_OID_USER} 0:256 bearer=${EACL_TOKEN} options=--xhdr a=256
Run Keyword And Expect Error * Should Contain ${ERR} ${ERROR}
... Get Range Hash ${WALLET} ${CID} ${S_OID_USER} ${EACL_TOKEN} 0:256 --xhdr a=256 ${ERR} = Run Keyword And Expect Error *
Run Keyword And Expect Error * ... Get Range Hash ${WALLET} ${CID} ${S_OID_USER} ${EACL_TOKEN} 0:256 options=--xhdr a=256
Should Contain ${ERR} ${ERROR}
${ERR} = Run Keyword And Expect Error *
... Delete object ${WALLET} ${CID} ${S_OID_USER} bearer=${EACL_TOKEN} options=--xhdr a=256 ... Delete object ${WALLET} ${CID} ${S_OID_USER} bearer=${EACL_TOKEN} options=--xhdr a=256
Should Contain ${ERR} ${ERROR}

View file

@ -11,17 +11,16 @@ Resource payment_operations.robot
Resource eacl_tables.robot Resource eacl_tables.robot
*** Variables *** *** Variables ***
${PATH} = testfile
&{USER_HEADER} = key1=1 key2=abc &{USER_HEADER} = key1=1 key2=abc
&{ANOTHER_HEADER} = key1=oth key2=oth &{ANOTHER_HEADER} = key1=oth key2=oth
${ID_FILTER} = $Object:objectID ${ID_FILTER} = $Object:objectID
${CUSTOM_FILTER} = $Object:key1 ${CUSTOM_FILTER} = key1
*** Test cases *** *** Test cases ***
Extended ACL Operations Extended ACL Operations
[Documentation] Testcase to validate NeoFS operations with extended ACL. [Documentation] Testcase to validate NeoFS operations with extended ACL.
[Tags] ACL eACL [Tags] ACL eACL
[Timeout] 2 min [Timeout] 3 min
Check Filters Simple Check Filters Simple
@ -51,7 +50,7 @@ Check eACL MatchType String Equal Request Deny
[Arguments] ${USER_WALLET} ${OTHER_WALLET} ${FILE_S} [Arguments] ${USER_WALLET} ${OTHER_WALLET} ${FILE_S}
${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write ${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write
${S_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} ${S_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER}
Get object ${USER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} Get object ${USER_WALLET} ${CID} ${S_OID_USER}
Set eACL ${USER_WALLET} ${CID} ${EACL_XHEADER_DENY_ALL} Set eACL ${USER_WALLET} ${CID} ${EACL_XHEADER_DENY_ALL}
@ -59,30 +58,30 @@ Check eACL MatchType String Equal Request Deny
Sleep ${NEOFS_CONTRACT_CACHE_TIMEOUT} Sleep ${NEOFS_CONTRACT_CACHE_TIMEOUT}
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} ${EMPTY} --xhdr a=2 ... Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} options=--xhdr a=2
Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} ${EMPTY} --xhdr a=256 Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} options=--xhdr a=256
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Put object ${OTHER_WALLET} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER} options=--xhdr a=2 ... Put object ${OTHER_WALLET} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER} options=--xhdr a=2
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} ${EMPTY} --xhdr a=2 ... Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} options=--xhdr a=2
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Search object ${OTHER_WALLET} ${CID} ${EMPTY} ${EMPTY} ${USER_HEADER} ${EMPTY} --xhdr a=2 ... Search object ${OTHER_WALLET} ${CID} filters=${USER_HEADER} options=--xhdr a=2
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Head object ${OTHER_WALLET} ${CID} ${S_OID_USER} options=--xhdr a=2 ... Head object ${OTHER_WALLET} ${CID} ${S_OID_USER} options=--xhdr a=2
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Get Range ${OTHER_WALLET} ${CID} ${S_OID_USER} 0:256 options=--xhdr a="2" ... Get Range ${OTHER_WALLET} ${CID} ${S_OID_USER} 0:256 options=--xhdr a="2"
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Get Range Hash ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} 0:256 --xhdr a=2 ... Get Range Hash ${OTHER_WALLET} ${CID} ${S_OID_USER} bearer_token=${EMPTY} range_cut=0:256 options=--xhdr a=2
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Delete object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} --xhdr a=2 ... Delete object ${OTHER_WALLET} ${CID} ${S_OID_USER} options=--xhdr a=2
Put object ${OTHER_WALLET} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER} options=--xhdr a=256 Put object ${OTHER_WALLET} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER} options=--xhdr a=256
Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} ${EMPTY} --xhdr a=* Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} options=--xhdr a=*
Search object ${OTHER_WALLET} ${CID} ${EMPTY} ${EMPTY} ${USER_HEADER} ${EMPTY} --xhdr a= Search object ${OTHER_WALLET} ${CID} filters=${USER_HEADER} options=--xhdr a=
Head object ${OTHER_WALLET} ${CID} ${S_OID_USER} options=--xhdr a=.* Head object ${OTHER_WALLET} ${CID} ${S_OID_USER} options=--xhdr a=.*
Get Range ${OTHER_WALLET} ${CID} ${S_OID_USER} 0:256 options=--xhdr a="2 2" Get Range ${OTHER_WALLET} ${CID} ${S_OID_USER} 0:256 options=--xhdr a="2 2"
Get Range Hash ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} 0:256 --xhdr a=256 Get Range Hash ${OTHER_WALLET} ${CID} ${S_OID_USER} bearer_token=${EMPTY} range_cut=0:256 options=--xhdr a=256
Delete object ${OTHER_WALLET} ${CID} ${S_OID_USER} options=--xhdr a=22 Delete object ${OTHER_WALLET} ${CID} ${S_OID_USER} options=--xhdr a=22
@ -91,7 +90,7 @@ Check eACL MatchType String Equal Request Allow
${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write ${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write
${S_OID_USER} = Put Object ${USER_WALLET} ${FILE_S} ${CID} ${S_OID_USER} = Put Object ${USER_WALLET} ${FILE_S} ${CID}
Get Object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} Get Object ${OTHER_WALLET} ${CID} ${S_OID_USER}
Set eACL ${USER_WALLET} ${CID} ${EACL_XHEADER_ALLOW_ALL} Set eACL ${USER_WALLET} ${CID} ${EACL_XHEADER_ALLOW_ALL}
@ -101,28 +100,28 @@ Check eACL MatchType String Equal Request Allow
Get eACL ${USER_WALLET} ${CID} Get eACL ${USER_WALLET} ${CID}
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} ${EMPTY} ... Get object ${OTHER_WALLET} ${CID} ${S_OID_USER}
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Put object ${OTHER_WALLET} ${FILE_S} ${CID} ... Put object ${OTHER_WALLET} ${FILE_S} ${CID}
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} ${EMPTY} ... Get object ${OTHER_WALLET} ${CID} ${S_OID_USER}
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Search object ${OTHER_WALLET} ${CID} ${EMPTY} ${EMPTY} ${USER_HEADER} ${EMPTY} ... Search object ${OTHER_WALLET} ${CID} filters=${USER_HEADER}
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Head object ${OTHER_WALLET} ${CID} ${S_OID_USER} ... Head object ${OTHER_WALLET} ${CID} ${S_OID_USER}
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Get Range ${OTHER_WALLET} ${CID} ${S_OID_USER} 0:256 ... Get Range ${OTHER_WALLET} ${CID} ${S_OID_USER} 0:256
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Get Range Hash ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} 0:256 ... Get Range Hash ${OTHER_WALLET} ${CID} ${S_OID_USER} bearer_token=${EMPTY} range_cut=0:256
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Delete object ${OTHER_WALLET} ${CID} ${S_OID_USER} ... Delete object ${OTHER_WALLET} ${CID} ${S_OID_USER}
Put object ${OTHER_WALLET} ${FILE_S} ${CID} options=--xhdr a=2 Put object ${OTHER_WALLET} ${FILE_S} ${CID} options=--xhdr a=2
Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} ${EMPTY} --xhdr a=2 Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} options=--xhdr a=2
Search object ${OTHER_WALLET} ${CID} ${EMPTY} ${EMPTY} ${USER_HEADER} ${EMPTY} --xhdr a=2 Search object ${OTHER_WALLET} ${CID} filters=${USER_HEADER} options=--xhdr a=2
Head object ${OTHER_WALLET} ${CID} ${S_OID_USER} options=--xhdr a=2 Head object ${OTHER_WALLET} ${CID} ${S_OID_USER} options=--xhdr a=2
Get Range ${OTHER_WALLET} ${CID} ${S_OID_USER} 0:256 options=--xhdr a=2 Get Range ${OTHER_WALLET} ${CID} ${S_OID_USER} 0:256 options=--xhdr a=2
Get Range Hash ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} 0:256 --xhdr a=2 Get Range Hash ${OTHER_WALLET} ${CID} ${S_OID_USER} bearer_token=${EMPTY} range_cut=0:256 options=--xhdr a=2
Delete object ${OTHER_WALLET} ${CID} ${S_OID_USER} options=--xhdr a=2 Delete object ${OTHER_WALLET} ${CID} ${S_OID_USER} options=--xhdr a=2
@ -131,7 +130,7 @@ Check eACL MatchType String Equal Object
${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write ${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write
${S_OID_USER} = Put Object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} ${S_OID_USER} = Put Object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER}
Get Object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} Get Object ${OTHER_WALLET} ${CID} ${S_OID_USER}
Log Set eACL for Deny GET operation with StringEqual Object ID Log Set eACL for Deny GET operation with StringEqual Object ID
@ -144,7 +143,7 @@ Check eACL MatchType String Equal Object
${EACL_CUSTOM} = Create eACL ${CID} ${eACL_gen} ${EACL_CUSTOM} = Create eACL ${CID} ${eACL_gen}
Set eACL ${USER_WALLET} ${CID} ${EACL_CUSTOM} Set eACL ${USER_WALLET} ${CID} ${EACL_CUSTOM}
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} ... Get object ${OTHER_WALLET} ${CID} ${S_OID_USER}
Log Set eACL for Deny GET operation with StringEqual Object Extended User Header Log Set eACL for Deny GET operation with StringEqual Object Extended User Header
@ -157,8 +156,8 @@ Check eACL MatchType String Equal Object
Set eACL ${USER_WALLET} ${CID} ${EACL_CUSTOM} Set eACL ${USER_WALLET} ${CID} ${EACL_CUSTOM}
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} ... Get object ${OTHER_WALLET} ${CID} ${S_OID_USER}
Get object ${OTHER_WALLET} ${CID} ${S_OID_USER_OTH} ${EMPTY} ${PATH} Get object ${OTHER_WALLET} ${CID} ${S_OID_USER_OTH}
Check eACL MatchType String Not Equal Object Check eACL MatchType String Not Equal Object
@ -166,10 +165,10 @@ Check eACL MatchType String Not Equal Object
${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write ${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write
${S_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} ${S_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID}
${S_OID_OTHER} = Put object ${OTHER_WALLET} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER} ${S_OID_OTHER} = Put object ${OTHER_WALLET} ${FILE_S} ${CID}
Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} Get object ${OTHER_WALLET} ${CID} ${S_OID_USER}
Get object ${OTHER_WALLET} ${CID} ${S_OID_OTHER} ${EMPTY} ${PATH} Get object ${OTHER_WALLET} ${CID} ${S_OID_OTHER}
Log Set eACL for Deny GET operation with StringNotEqual Object ID Log Set eACL for Deny GET operation with StringNotEqual Object ID
@ -183,8 +182,8 @@ Check eACL MatchType String Not Equal Object
Set eACL ${USER_WALLET} ${CID} ${EACL_CUSTOM} Set eACL ${USER_WALLET} ${CID} ${EACL_CUSTOM}
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Get object ${OTHER_WALLET} ${CID} ${S_OID_OTHER} ${EMPTY} ${PATH} ... Get object ${OTHER_WALLET} ${CID} ${S_OID_OTHER}
Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} Get object ${OTHER_WALLET} ${CID} ${S_OID_USER}
Log Set eACL for Deny GET operation with StringEqual Object Extended User Header Log Set eACL for Deny GET operation with StringEqual Object Extended User Header
@ -196,5 +195,5 @@ Check eACL MatchType String Not Equal Object
Set eACL ${USER_WALLET} ${CID} ${EACL_CUSTOM} Set eACL ${USER_WALLET} ${CID} ${EACL_CUSTOM}
Run Keyword And Expect Error * Run Keyword And Expect Error *
... Get object ${OTHER_WALLET} ${CID} ${S_OID_USER_OTH} ${EMPTY} ${PATH} ... Get object ${OTHER_WALLET} ${CID} ${S_OID_USER_OTH}
Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} Get object ${OTHER_WALLET} ${CID} ${S_OID_USER}