Cleanup teardown has been added. Fixes. Added ACL bearer token scrnario for filter with user headers.

This commit is contained in:
anatoly@nspcc.ru 2020-12-03 02:08:05 +03:00
parent ee4c775ef4
commit 522de42ab6
9 changed files with 318 additions and 236 deletions

View file

@ -826,16 +826,18 @@ def verify_file_hash(filename, expected_hash):
else:
raise Exception("File hash '{}' is not equal to {}".format(file_hash, expected_hash))
@keyword('Cleanup File')
# remove temp files
def cleanup_file(filename: str):
@keyword('Cleanup Files')
def cleanup_file(*filename_list):
for filename in filename_list:
if os.path.isfile(filename):
try:
os.remove(filename)
except OSError as e:
raise Exception("Error: '%s' - %s." % (e.filename, e.strerror))
else:
raise Exception("Error: '%s' file not found" % filename)
logger.warn("Error: '%s' file not found" % filename)
logger.info("File '%s' has been deleted." % filename)

View file

@ -23,6 +23,7 @@ Basic ACL Operations
Check Public Container
Check Read-Only Container
[Teardown] Cleanup
@ -282,3 +283,9 @@ Check Read-Only Container
Run Keyword And Expect Error *
... Delete object ${SYSTEM_KEY_SN} ${READONLY_CID} ${S_OID_USER} ${EMPTY}
Delete object ${USER_KEY} ${READONLY_CID} ${S_OID_USER} ${EMPTY}
Cleanup
@{CLEANUP_FILES} = Create List ${FILE_S} s_file_read s_get_range
Cleanup Files @{CLEANUP_FILES}

View file

@ -21,23 +21,20 @@ BearerToken Operations
Generate Keys
Generate file
Prepare eACL Role rules
Check Bearer
*** Keywords ***
Check Bearer
Check Container Inaccessible and Allow All Bearer
Check eACL Deny and Allow All Bearer
Check eACL Deny and Allow All Bearer Filter OID Equal
Check eACL Deny and Allow All Bearer Filter OID NotEqual
Check eACL Deny and Allow All Bearer Filter UserHeader Equal
[Teardown] Cleanup
*** Keywords ***
Generate Keys
${WALLET} = Init wallet
@ -285,8 +282,60 @@ Check eACL Deny and Allow All Bearer Filter OID NotEqual
Check eACL Deny and Allow All Bearer Filter UserHeader Equal
${CID} = Create Container Public
${S_OID_USER} = Put object to NeoFS ${USER_KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_USR_HEADER}
${S_OID_USER_2} = Put object to NeoFS ${USER_KEY} ${FILE_S} ${CID} ${EMPTY} ${EMPTY}
${D_OID_USER} = Put object to NeoFS ${USER_KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_USR_HEADER_DEL}
@{S_OBJ_H} = Create List ${S_OID_USER}
Put object to NeoFS ${USER_KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_OTH_HEADER}
Get object from NeoFS ${USER_KEY} ${CID} ${S_OID_USER} ${EMPTY} local_file_eacl
Search object ${USER_KEY} ${CID} ${EMPTY} ${EMPTY} ${FILE_USR_HEADER} @{S_OBJ_H}
Head object ${USER_KEY} ${CID} ${S_OID_USER} ${EMPTY}
Get Range ${USER_KEY} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256
Delete object ${USER_KEY} ${CID} ${D_OID_USER} ${EMPTY}
Set eACL ${USER_KEY} ${CID} ${EACL_DENY_ALL_USER} --await
Form BearerToken file filter for all ops bearer_allow_all_user ${USER_KEY} ${CID} ALLOW USER 100500 STRING_EQUAL key2 abc
Run Keyword And Expect Error *
... Put object to NeoFS ${USER_KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_USR_HEADER}
Run Keyword And Expect Error *
... Get object from NeoFS ${USER_KEY} ${CID} ${S_OID_USER} ${EMPTY} local_file_eacl
Run Keyword And Expect Error *
... Search object ${USER_KEY} ${CID} ${EMPTY} ${EMPTY} ${FILE_USR_HEADER} @{S_OBJ_H}
Run Keyword And Expect Error *
... Head object ${USER_KEY} ${CID} ${S_OID_USER} ${EMPTY}
Run Keyword And Expect Error *
... Get Range ${USER_KEY} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256
Run Keyword And Expect Error *
... Delete object ${USER_KEY} ${CID} ${S_OID_USER} ${EMPTY}
# Search is allowed without filter condition.
Search object ${USER_KEY} ${CID} ${EMPTY} bearer_allow_all_user ${FILE_USR_HEADER} @{S_OBJ_H}
Run Keyword And Expect Error *
... Put object to NeoFS ${USER_KEY} ${FILE_S} ${CID} bearer_allow_all_user ${FILE_OTH_HEADER}
Run Keyword And Expect Error *
... Get object from NeoFS ${USER_KEY} ${CID} ${S_OID_USER_2} bearer_allow_all_user local_file_eacl
# Preiodical issue: https://github.com/nspcc-dev/neofs-node/issues/225
Get object from NeoFS ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user local_file_eacl
Get Range ${USER_KEY} ${CID} ${S_OID_USER} s_get_range bearer_allow_all_user 0:256
# https://github.com/nspcc-dev/neofs-node/issues/215
# Head object ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user
# Delete object ${USER_KEY} ${CID} ${D_OID_USER} bearer_allow_all_user
#Check eACL Deny and Allow All Bearer Filter UserHeader Equal
# Check eACL Deny and Allow All Bearer Filter UserHeader NotEqual
# Check eACL Deny and Allow All Bearer for big object
# Check eACL Deny and Allow All Bearer Filter UserHeader Equal for big object
Cleanup
@{CLEANUP_FILES} = Create List ${FILE_S} local_file_eacl s_get_range bearer_allow_all_user
Cleanup Files @{CLEANUP_FILES}

View file

@ -1,8 +1,6 @@
*** Settings ***
Variables ../../variables/common.py
Library Collections
Library ${RESOURCES}/neofs.py
Library ${RESOURCES}/payment_neogo.py
@ -25,6 +23,7 @@ Extended ACL Operations
Check Actions
Check Filters
[Teardown] Cleanup
*** Keywords ***
@ -70,7 +69,6 @@ Check eACL MatchType String Equal
Check eACL MatchType String Not Equal
${CID} = Create Container Public
${FILE_S_2} = Generate file of bytes 2048
${S_OID_USER} = Put object to NeoFS ${USER_KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_USR_HEADER}
${S_OID_OTHER} = Put object to NeoFS ${OTHER_KEY} ${FILE_S_2} ${CID} ${EMPTY} ${FILE_OTH_HEADER}
@ -154,12 +152,15 @@ Create Container Public
Generate file
${FILE_S_GEN} = Generate file of bytes 1024
Set Global Variable ${FILE_S} ${FILE_S_GEN}
${FILE_S_GEN_1} = Generate file of bytes 1024
${FILE_S_GEN_2} = Generate file of bytes 2048
Set Global Variable ${FILE_S} ${FILE_S_GEN_1}
Set Global Variable ${FILE_S_2} ${FILE_S_GEN_2}
Prepare eACL Role rules
Log Set eACL for different Role cases
Set Global Variable ${EACL_DENY_ALL_OTHER} robot/resources/lib/eacl/eacl_encoded_deny_all
Set Global Variable ${EACL_ALLOW_ALL_OTHER} robot/resources/lib/eacl/eacl_encoded_allow_all
@ -356,3 +357,6 @@ Check eACL Deny and Allow All
Get Range ${KEY} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256
Delete object ${KEY} ${CID} ${S_OID_USER} ${EMPTY}
Cleanup
@{CLEANUP_FILES} = Create List ${FILE_S} ${FILE_S_2} local_file_eacl eacl_custom s_get_range
Cleanup Files @{CLEANUP_FILES}

View file

@ -12,8 +12,8 @@ NeoFS Simple Netmap
[Timeout] 20 min
Generate Key and Pre-payment
Generate file
Generate file
Validate Policy REP 2 IN X CBF 2 SELECT 2 FROM * AS X 2 @{EMPTY}
@ -60,6 +60,7 @@ NeoFS Simple Netmap
Run Keyword And Expect Error *
... Validate Policy REP 2 IN X CBF 2 SELECT 6 FROM * AS X 2 @{EMPTY}
[Teardown] Cleanup Files ${FILE}
*** Keywords ***

View file

@ -89,6 +89,7 @@ NeoFS Complex Object Operations
Delete object ${PRIV_KEY} ${CID} ${S_OID} ${EMPTY}
Delete object ${PRIV_KEY} ${CID} ${H_OID} ${EMPTY}
#Verify Head tombstone ${PRIV_KEY} ${CID} ${S_OID}
Sleep 2min
@ -98,11 +99,15 @@ NeoFS Complex Object Operations
Run Keyword And Expect Error *
... Get object from NeoFS ${PRIV_KEY} ${CID} ${H_OID} ${EMPTY} h_file_read
Cleanup File ${FILE}
Cleanup File s_file_read
Cleanup File h_file_read
Cleanup File s_get_range
Cleanup File h_get_range
[Teardown] Cleanup ${FILE}
*** Keywords ***
Cleanup
[Arguments] ${FILE}
@{CLEANUP_FILES} = Create List ${FILE} s_file_read h_file_read s_get_range h_get_range
Cleanup Files @{CLEANUP_FILES}

View file

@ -87,11 +87,19 @@ NeoFS Simple Object Operations
Run Keyword And Expect Error *
... Get object from NeoFS ${PRIV_KEY} ${CID} ${H_OID} ${EMPTY} h_file_read
Cleanup File ${FILE}
Cleanup File s_file_read
Cleanup File h_file_read
Cleanup File s_get_range
Cleanup File h_get_range
[Teardown] Cleanup ${FILE}
*** Keywords ***
Cleanup
[Arguments] ${FILE}
@{CLEANUP_FILES} = Create List ${FILE} s_file_read h_file_read s_get_range h_get_range
Cleanup Files @{CLEANUP_FILES}

View file

@ -30,9 +30,11 @@ NeoFS Object Replication
Sleep 1 min
${CID} = Create container ${PRIV_KEY} ${EMPTY} REP 2 IN X CBF 1 SELECT 4 FROM * AS X
Container Existing ${PRIV_KEY} ${CID}
${FILE} = Generate file of bytes 1024
${FILE_HASH} = Get file hash ${FILE}
@ -43,3 +45,7 @@ NeoFS Object Replication
Sleep 1 min
Validate storage policy for object ${PRIV_KEY} 2 ${CID} ${S_OID}
Start nodes @{NODES_OBJ_STOPPED}
[Teardown] Cleanup Files ${FILE}