From b27159b4177a5cfd2155a3ea2fd03d8d3a205d17 Mon Sep 17 00:00:00 2001 From: anastasia prasolova Date: Mon, 14 Mar 2022 11:39:24 +0300 Subject: [PATCH] `s3_gate_object` refactoring Signed-off-by: anastasia prasolova --- .../integration/services/s3_gate_object.robot | 53 ++++++++----------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/robot/testsuites/integration/services/s3_gate_object.robot b/robot/testsuites/integration/services/s3_gate_object.robot index 057cd178..79ead27b 100644 --- a/robot/testsuites/integration/services/s3_gate_object.robot +++ b/robot/testsuites/integration/services/s3_gate_object.robot @@ -2,19 +2,17 @@ Variables common.py Library Collections +Library OperatingSystem + Library neofs.py -Library payment_neogo.py -Library gates.py -Library wallet_keywords.py +Library s3_gate.py Library contract_keywords.py -Library utility_keywords.py Resource setup_teardown.robot +Resource payment_operations.robot *** Variables *** -${DEPOSIT_AMOUNT} = ${5} -${WIF} = ${MAINNET_WALLET_WIF} -@{INCLUDE_SVC} = s3_gate +@{INCLUDE_SVC} = s3_gate coredns *** Test cases *** Objects in NeoFS S3 Gateway @@ -22,17 +20,14 @@ Objects in NeoFS S3 Gateway [Documentation] Execute operations with objects via S3 Gate [Timeout] 10 min - [Setup] Setup + [Setup] Setup Make Up ${INCLUDE_SVC} - ${WALLET} ${ADDR} = Init Wallet from WIF ${ASSETS_DIR} ${WIF} - ${TX_DEPOSIT} = NeoFS Deposit ${WIF} ${DEPOSIT_AMOUNT} - Wait Until Keyword Succeeds 1 min 15 sec - ... Transaction accepted in block ${TX_DEPOSIT} + ${WALLET} ${_} ${WIF} = Prepare Wallet And Deposit ${FILE_S3} = Generate file of bytes ${COMPLEX_OBJ_SIZE} ${FILE_S3_HASH} = Get file hash ${FILE_S3} - ${FILE_S3_NAME} = Get file name ${FILE_S3} + ${_} ${S3_OBJECT_KEY} = Split Path ${FILE_S3} ${CID} ... ${BUCKET} @@ -44,39 +39,37 @@ Objects in NeoFS S3 Gateway List Should Contain Value ${CONTEINERS_LIST} ${CID} ${S3_CLIENT} = Config S3 client ${ACCESS_KEY_ID} ${SEC_ACCESS_KEY} - ${NEW_BUCKET} = Create Bucket S3 ${S3_CLIENT} ${NEW_BUCKET_2} = Create Bucket S3 ${S3_CLIENT} Put object S3 ${S3_CLIENT} ${NEW_BUCKET} ${FILE_S3} - Head object S3 ${S3_CLIENT} ${NEW_BUCKET} ${FILE_S3_NAME} + Head object S3 ${S3_CLIENT} ${NEW_BUCKET} ${S3_OBJECT_KEY} Put object S3 ${S3_CLIENT} ${NEW_BUCKET_2} ${FILE_S3} - Head object S3 ${S3_CLIENT} ${NEW_BUCKET_2} ${FILE_S3_NAME} + Head object S3 ${S3_CLIENT} ${NEW_BUCKET_2} ${S3_OBJECT_KEY} ${LIST_S3_OBJECTS} = List objects S3 ${S3_CLIENT} ${NEW_BUCKET} - List Should Contain Value ${LIST_S3_OBJECTS} ${FILE_S3_NAME} + List Should Contain Value ${LIST_S3_OBJECTS} ${S3_OBJECT_KEY} ${LIST_S3_OBJECTS_2} = List objects S3 ${S3_CLIENT} ${NEW_BUCKET_2} - List Should Contain Value ${LIST_S3_OBJECTS_2} ${FILE_S3_NAME} + List Should Contain Value ${LIST_S3_OBJECTS_2} ${S3_OBJECT_KEY} ${LIST_V2_S3_OBJECTS} = List objects S3 v2 ${S3_CLIENT} ${NEW_BUCKET} - List Should Contain Value ${LIST_V2_S3_OBJECTS} ${FILE_S3_NAME} - - Get object S3 ${S3_CLIENT} ${NEW_BUCKET} ${FILE_S3_NAME} s3_obj_get_s3 + List Should Contain Value ${LIST_V2_S3_OBJECTS} ${S3_OBJECT_KEY} - Verify file hash s3_obj_get_s3 ${FILE_S3_HASH} + ${OBJ_PATH} = Get object S3 ${S3_CLIENT} ${NEW_BUCKET} ${S3_OBJECT_KEY} + Verify file hash ${OBJ_PATH} ${FILE_S3_HASH} #TODO: Solve the issue on CopyObject #260 https://github.com/nspcc-dev/neofs-s3-gw/issues/260 - Copy object S3 ${S3_CLIENT} ${NEW_BUCKET} ${FILE_S3_NAME} NewName - ${LIST_S3_OBJECTS} = List objects S3 ${S3_CLIENT} ${NEW_BUCKET} - List Should Contain Value ${LIST_S3_OBJECTS} NewName - Copy object S3 ${S3_CLIENT} ${NEW_BUCKET_2} ${FILE_S3_NAME} NewName_2 - ${LIST_S3_OBJECTS_2} = List objects S3 ${S3_CLIENT} ${NEW_BUCKET_2} - List Should Contain Value ${LIST_S3_OBJECTS_2} NewName_2 + ${COPIED_OBJ_PATH} = Copy object S3 ${S3_CLIENT} ${NEW_BUCKET} ${S3_OBJECT_KEY} + ${LIST_S3_OBJECTS} = List objects S3 ${S3_CLIENT} ${NEW_BUCKET} + List Should Contain Value ${LIST_S3_OBJECTS} ${COPIED_OBJ_PATH} + ${COPIED_OBJ_PATH_2} = Copy object S3 ${S3_CLIENT} ${NEW_BUCKET_2} ${S3_OBJECT_KEY} + ${LIST_S3_OBJECTS_2} = List objects S3 ${S3_CLIENT} ${NEW_BUCKET_2} + List Should Contain Value ${LIST_S3_OBJECTS_2} ${COPIED_OBJ_PATH_2} - Delete object S3 ${S3_CLIENT} ${NEW_BUCKET} ${FILE_S3_NAME} + Delete object S3 ${S3_CLIENT} ${NEW_BUCKET} ${S3_OBJECT_KEY} ${LIST_S3_OBJECTS} = List objects S3 ${S3_CLIENT} ${NEW_BUCKET} - List Should Not Contain Value ${LIST_S3_OBJECTS} ${FILE_S3_NAME} + List Should Not Contain Value ${LIST_S3_OBJECTS} ${S3_OBJECT_KEY} [Teardown] Teardown s3_gate_object