get rid of duplicated "create container" keywords for extended acl suites

Signed-off-by: anastasia prasolova <anastasia@nspcc.ru>
This commit is contained in:
anastasia prasolova 2022-05-19 13:54:07 +03:00 committed by Anastasia Prasolova
parent 3ea4578683
commit d1595b78ca
8 changed files with 119 additions and 124 deletions

View file

@ -8,6 +8,7 @@ Library neofs.py
Library neofs_verbs.py
Library Collections
Library String
Resource common_steps_acl_basic.robot
Resource payment_operations.robot
@ -21,11 +22,6 @@ ${EACL_ERR_MSG} = *
*** Keywords ***
Create Container Public
[Arguments] ${WALLET}
${PUBLIC_CID_GEN} = Create container ${WALLET} basic_acl=${PUBLIC_ACL}
[Return] ${PUBLIC_CID_GEN}
Generate files
[Arguments] ${SIZE}
@ -38,7 +34,7 @@ Generate files
Check eACL Deny and Allow All
[Arguments] ${WALLET} ${DENY_EACL} ${ALLOW_EACL} ${USER_WALLET}
${CID} = Create Container Public ${USER_WALLET}
${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write
${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE}
${S_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER}
${D_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER_DEL}
@ -88,9 +84,7 @@ Check eACL Deny and Allow All
Delete object ${WALLET} ${CID} ${S_OID_USER}
Compose eACL Custom
[Arguments] ${CID} ${HEADER_DICT} ${MATCH_TYPE} ${FILTER} ${ACCESS} ${ROLE}
${filter_value} = Get From dictionary ${HEADER_DICT} ${EACL_OBJ_FILTERS}[${FILTER}]
[Arguments] ${CID} ${filter_value} ${MATCH_TYPE} ${FILTER} ${ACCESS} ${ROLE}
${filters} = Set Variable obj:${FILTER}${MATCH_TYPE}${filter_value}
${rule_get}= Set Variable ${ACCESS} get ${filters} ${ROLE}
@ -107,16 +101,6 @@ Compose eACL Custom
[Return] ${EACL_CUSTOM}
Object Header Decoded
[Arguments] ${WALLET} ${CID} ${OID}
&{HEADER} = Head Object ${WALLET} ${CID} ${OID}
# FIXME
# 'objectID' key repositioning in dictionary for the calling keyword might
# work uniformly with any key from 'header'
Set To Dictionary ${HEADER}[header] objectID ${HEADER}[objectID]
[Return] &{HEADER}[header]
Check eACL Filters with MatchType String Equal
[Arguments] ${FILTER}
@ -124,7 +108,7 @@ Check eACL Filters with MatchType String Equal
${WALLET} ${_} ${_} = Prepare Wallet And Deposit
${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit
${CID} = Create Container Public ${WALLET}
${CID} = Create Container ${WALLET} basic_acl=eacl-public-read-write
${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE}
${S_OID_USER} = Put Object ${WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER}
@ -133,13 +117,20 @@ Check eACL Filters with MatchType String Equal
Get Object ${WALLET_OTH} ${CID} ${S_OID_USER} ${EMPTY} local_file_eacl
Search Object ${WALLET_OTH} ${CID} ${EMPTY} ${EMPTY} ${USER_HEADER} ${S_OBJ_H}
Head Object ${WALLET_OTH} ${CID} ${S_OID_USER}
&{HEADER} = Head Object ${WALLET_OTH} ${CID} ${S_OID_USER}
Get Range ${WALLET_OTH} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256
Get Range Hash ${WALLET_OTH} ${CID} ${S_OID_USER} ${EMPTY} 0:256
Delete Object ${WALLET_OTH} ${CID} ${D_OID_USER}
&{HEADER_DICT} = Object Header Decoded ${WALLET} ${CID} ${S_OID_USER}
${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER_DICT} = ${FILTER} DENY OTHERS
${K} ${V} = Split String ${FILTER} :
${EACL_CUSTOM} = Set Variable
IF """${v}""" == """objectID"""
${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER}[${V}]
... = ${FILTER} DENY OTHERS
ELSE
${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER}[header][${V}]
... = ${FILTER} DENY OTHERS
END
Set eACL ${WALLET} ${CID} ${EACL_CUSTOM}
# The current ACL cache lifetime is 30 sec
@ -176,7 +167,7 @@ Check eACL Filters with MatchType String Not Equal
${WALLET} ${_} ${_} = Prepare Wallet And Deposit
${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit
${CID} = Create Container Public ${WALLET}
${CID} = Create Container ${WALLET} basic_acl=eacl-public-read-write
${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE}
${S_OID_OTH} = Put Object ${WALLET_OTH} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER}
@ -185,13 +176,20 @@ Check eACL Filters with MatchType String Not Equal
@{S_OBJ_H} = Create List ${S_OID_USER}
Get Object ${WALLET} ${CID} ${S_OID_USER} ${EMPTY} local_file_eacl
Head Object ${WALLET} ${CID} ${S_OID_USER}
Search Object ${WALLET} ${CID} ${EMPTY} ${EMPTY} ${FILE_USR_HEADER} ${S_OBJ_H}
&{HEADER} = Head Object ${WALLET} ${CID} ${S_OID_USER}
Search Object ${WALLET} ${CID} ${EMPTY} ${EMPTY} ${USER_HEADER} ${S_OBJ_H}
Get Range ${WALLET} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256
Get Range Hash ${WALLET} ${CID} ${S_OID_USER} ${EMPTY} 0:256
&{HEADER_DICT} = Object Header Decoded ${WALLET} ${CID} ${S_OID_USER}
${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER_DICT} != ${FILTER} deny others
${K} ${V} = Split String ${FILTER} :
${EACL_CUSTOM} = Set Variable
IF """${v}""" == """objectID"""
${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER}[${V}]
... != ${FILTER} DENY OTHERS
ELSE
${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER}[header][${V}]
... != ${FILTER} DENY OTHERS
END
Set eACL ${WALLET} ${CID} ${EACL_CUSTOM}
# The current ACL cache lifetime is 30 sec

View file

@ -3,6 +3,7 @@ Variables common.py
Library Collections
Library acl.py
Library container.py
Library neofs.py
Library neofs_verbs.py
Library payment_neogo.py
@ -47,7 +48,7 @@ Extended ACL Operations
Check eACL Deny All Other and Allow All Pubkey
[Arguments] ${USER_WALLET} ${FILE_S} ${WALLET_OTH}
${CID} = Create Container Public ${USER_WALLET}
${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}
${D_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER_DEL}
@{S_OBJ_H} = Create List ${S_OID_USER}

View file

@ -2,10 +2,11 @@
Variables common.py
Library Collections
Library acl.py
Library container.py
Library neofs.py
Library neofs_verbs.py
Library payment_neogo.py
Library acl.py
Resource common_steps_acl_extended.robot
Resource payment_operations.robot
@ -46,7 +47,7 @@ Check eACL Deny and Allow All System
${WALLET_SN} ${_} = Prepare Wallet with WIF And Deposit ${NEOFS_SN_WIF}
${WALLET_IR} ${_} = Prepare Wallet with WIF And Deposit ${NEOFS_IR_WIF}
${CID} = Create Container Public ${WALLET}
${CID} = Create Container ${WALLET} basic_acl=eacl-public-read-write
${S_OID_USER} = Put object ${WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER}
${D_OID_USER_S} = Put object ${WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER_DEL}

View file

@ -2,10 +2,11 @@
Variables common.py
Library Collections
Library acl.py
Library container.py
Library neofs.py
Library neofs_verbs.py
Library payment_neogo.py
Library acl.py
Resource common_steps_acl_extended.robot
Resource payment_operations.robot
@ -63,7 +64,7 @@ Check Сompound Operations
Check eACL Сompound Get
[Arguments] ${WALLET} ${DENY_EACL} ${FILE_S} ${USER_WALLET} ${WALLET_SYS}
${CID} = Create Container Public ${USER_WALLET}
${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}
Put object ${WALLET} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER}
@ -89,7 +90,7 @@ Check eACL Сompound Get
Check eACL Сompound Delete
[Arguments] ${WALLET} ${DENY_EACL} ${FILE_S} ${USER_WALLET} ${WALLET_SYS}
${CID} = Create Container Public ${USER_WALLET}
${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}
${D_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID}
@ -118,11 +119,10 @@ Check eACL Сompound Delete
END
Check eACL Сompound Get Range Hash
[Arguments] ${WALLET} ${DENY_EACL} ${FILE_S} ${USER_WALLET} ${WALLET_SYS}
${CID} = Create Container Public ${USER_WALLET}
${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}
Put object ${WALLET} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER}

View file

@ -2,11 +2,12 @@
Variables common.py
Library acl.py
Library container.py
Library contract_keywords.py
Library neofs.py
Library neofs_verbs.py
Library payment_neogo.py
Library Collections
Library contract_keywords.py
Resource common_steps_acl_extended.robot
Resource payment_operations.robot
@ -52,9 +53,10 @@ Check Filters
Check eACL MatchType String Equal Request Deny ${WALLET} ${WALLET_OTH}
Check eACL MatchType String Equal Request Allow ${WALLET} ${WALLET_OTH}
Check eACL MatchType String Equal Request Deny
[Arguments] ${USER_WALLET} ${OTHER_WALLET}
${CID} = Create Container Public ${USER_WALLET}
${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}
Get object ${USER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH}
@ -94,7 +96,7 @@ Check eACL MatchType String Equal Request Deny
Check eACL MatchType String Equal Request Allow
[Arguments] ${USER_WALLET} ${OTHER_WALLET}
${CID} = Create Container Public ${USER_WALLET}
${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write
${S_OID_USER} = Put Object ${USER_WALLET} ${FILE_S} ${CID}
Get Object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH}
@ -134,7 +136,7 @@ Check eACL MatchType String Equal Request Allow
Check eACL MatchType String Equal Object
[Arguments] ${USER_WALLET} ${OTHER_WALLET}
${CID} = Create Container Public ${USER_WALLET}
${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}
Get Object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH}
@ -151,7 +153,6 @@ Check eACL MatchType String Equal Object
Run Keyword And Expect Error *
... Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH}
Log Set eACL for Deny GET operation with StringEqual Object Extended User Header
${S_OID_USER_OTH} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER}
@ -170,7 +171,7 @@ Check eACL MatchType String Equal Object
Check eACL MatchType String Not Equal Object
[Arguments] ${USER_WALLET} ${OTHER_WALLET}
${CID} = Create Container Public ${USER_WALLET}
${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_OTHER} = Put object ${OTHER_WALLET} ${FILE_S_2} ${CID} user_headers=${ANOTHER_HEADER}

View file

@ -3,6 +3,7 @@ Variables common.py
Variables eacl_object_filters.py
Library acl.py
Library container.py
Library neofs.py
Library Collections
Library contract_keywords.py
@ -24,9 +25,7 @@ Creation Epoch Object Filter for Extended ACL
[Setup] Setup
Log Check eACL creationEpoch Filter with MatchType String Equal
Check eACL Filters with MatchType String Equal $Object:creationEpoch
Log Check eACL creationEpoch Filter with MatchType String Not Equal
Check $Object:creationEpoch Filter with MatchType String Not Equal $Object:creationEpoch
[Teardown] Teardown creation_epoch_filter
@ -39,17 +38,16 @@ Check $Object:creationEpoch Filter with MatchType String Not Equal
${WALLET} ${_} ${_} = Prepare Wallet And Deposit
${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit
${CID} = Create Container Public ${WALLET}
${CID} = Create Container ${WALLET} basic_acl=eacl-public-read-write
${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE}
${S_OID} = Put Object ${WALLET} ${FILE_S} ${CID}
Tick Epoch
${S_OID_NEW} = Put Object ${WALLET} ${FILE_S} ${CID}
Get Object ${WALLET} ${CID} ${S_OID_NEW} ${EMPTY} local_file_eacl
&{HEADER} = Head Object ${WALLET} ${CID} ${S_OID_NEW}
&{HEADER_DICT} = Head Object ${WALLET} ${CID} ${S_OID_NEW}
${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER_DICT} != ${FILTER} DENY OTHERS
${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER}[header][creationEpoch] != ${FILTER} DENY OTHERS
Set eACL ${WALLET} ${CID} ${EACL_CUSTOM}
Run Keyword And Expect Error ${EACL_ERR_MSG}

View file

@ -3,6 +3,7 @@ Variables common.py
Variables eacl_object_filters.py
Library acl.py
Library container.py
Library neofs.py
Library Collections
@ -18,26 +19,22 @@ ${EACL_ERR_MSG} = *
*** Test cases ***
Object ID Object Filter for Extended ACL
[Documentation] Testcase to validate if $Object:objectID eACL filter is correctly handled.
[Tags] ACL eACL NeoFS NeoCLI
[Tags] ACL eACL
[Timeout] 20 min
[Setup] Setup
Log Check eACL objectID Filter with MatchType String Equal
Check eACL Filters with MatchType String Equal $Object:objectID
Log Check eACL objectID Filter with MatchType String Not Equal
Check eACL Filters with MatchType String Not Equal $Object:objectID
#################################################################################
# If the first eACL rule contradicts the second, the second one won't be applied
#################################################################################
Log Check if the second rule that contradicts the first is not applied
Check eACL Filters with MatchType String Equal with two contradicting filters $Object:objectID
###########################################################################################################################
# If both STRING_EQUAL and STRING_NOT_EQUAL matchTypes are applied for the same filter value, no object can be operated on
###########################################################################################################################
Log Check two matchTypes applied
Check eACL Filters, two matchTypes $Object:objectID
[Teardown] Teardown object_id
@ -51,15 +48,15 @@ Check eACL Filters with MatchType String Equal with two contradicting filters
${WALLET} ${_} ${_} = Prepare Wallet And Deposit
${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit
${CID} = Create Container Public ${WALLET}
${CID} = Create Container ${WALLET} basic_acl=eacl-public-read-write
${FILE_S_USER} ${_} = Generate file ${SIMPLE_OBJ_SIZE}
${S_OID_USER} = Put Object ${WALLET} ${FILE_S_USER} ${CID} ${EMPTY}
&{HEADER_DICT_USER} = Object Header Decoded ${WALLET} ${CID} ${S_OID_USER}
Get Object ${WALLET_OTH} ${CID} ${S_OID_USER} ${EMPTY} ${OBJECT_PATH}
${filter_value} = Get From Dictionary ${HEADER_DICT_USER} ${EACL_OBJ_FILTERS}[${FILTER}]
&{HEADER} = Head Object ${WALLET} ${CID} ${S_OID_USER}
${filter_value} = Get From Dictionary ${HEADER} ${EACL_OBJ_FILTERS}[${FILTER}]
${filters} = Set Variable obj:${FILTER}=${filter_value}
${rule} = Set Variable allow get ${filters} others
${contradicting_filters} = Set Variable obj:$Object:payloadLength=${SIMPLE_OBJ_SIZE}
@ -70,23 +67,24 @@ Check eACL Filters with MatchType String Equal with two contradicting filters
Set eACL ${WALLET} ${CID} ${EACL_CUSTOM}
Get object ${WALLET_OTH} ${CID} ${S_OID_USER} ${EMPTY} ${OBJECT_PATH}
Check eACL Filters, two matchTypes
[Arguments] ${FILTER}
${WALLET} ${_} ${_} = Prepare Wallet And Deposit
${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit
${CID} = Create Container Public ${WALLET}
${CID} = Create Container ${WALLET} basic_acl=eacl-public-read-write
${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE}
${S_OID_USER} = Put Object ${WALLET} ${FILE_S} ${CID} ${EMPTY}
${S_OID_OTHER} = Put Object ${WALLET_OTH} ${FILE_S} ${CID} ${EMPTY}
&{HEADER_DICT_USER} = Object Header Decoded ${WALLET} ${CID} ${S_OID_USER}
&{HEADER} = Head Object ${WALLET} ${CID} ${S_OID_USER}
Get Object ${WALLET_OTH} ${CID} ${S_OID_USER} ${EMPTY} ${OBJECT_PATH}
Get Object ${WALLET_OTH} ${CID} ${S_OID_OTHER} ${EMPTY} ${OBJECT_PATH}
${filter_value} = Get From Dictionary ${HEADER_DICT_USER} ${EACL_OBJ_FILTERS}[${FILTER}]
${filter_value} = Get From Dictionary ${HEADER} ${EACL_OBJ_FILTERS}[${FILTER}]
${noneq_filters} = Set Variable obj:${FILTER}!=${filter_value}
${rule_noneq_filter} = Set Variable deny get ${noneq_filters} others
${eq_filters} = Set Variable obj:${FILTER}=${filter_value}

View file

@ -3,6 +3,7 @@ Variables common.py
Variables eacl_object_filters.py
Library acl.py
Library container.py
Library neofs.py
Library Collections
@ -23,9 +24,7 @@ Payload Length Object Filter for Extended ACL
[Setup] Setup
Log Check eACL payloadLength Filter with MatchType String Equal
Check eACL Filters with MatchType String Equal $Object:payloadLength
Log Check eACL payloadLength Filter with MatchType String Not Equal
Check $Object:payloadLength Filter with MatchType String Not Equal $Object:payloadLength
[Teardown] Teardown payload_length_filter
@ -38,7 +37,7 @@ Check $Object:payloadLength Filter with MatchType String Not Equal
${WALLET} ${_} ${_} = Prepare Wallet And Deposit
${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit
${CID} = Create Container Public ${WALLET}
${CID} = Create Container ${WALLET} basic_acl=eacl-public-read-write
${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE}
${FILE_0} ${_} = Generate file ${0}
@ -46,10 +45,9 @@ Check $Object:payloadLength Filter with MatchType String Not Equal
${S_OID} = Put Object ${WALLET} ${FILE_S} ${CID}
Get Object ${WALLET} ${CID} ${S_OID} ${EMPTY} local_file_eacl
Head Object ${WALLET} ${CID} ${S_OID}
&{HEADER} = Head Object ${WALLET} ${CID} ${S_OID}
&{HEADER_DICT} = Object Header Decoded ${WALLET} ${CID} ${S_OID}
${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER_DICT} != ${FILTER} DENY OTHERS
${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER}[header][payloadLength] != ${FILTER} DENY OTHERS
Set eACL ${WALLET} ${CID} ${EACL_CUSTOM}
Run Keyword And Expect Error ${EACL_ERR_MSG}