forked from TrueCloudLab/frostfs-testcases
d940fe9573
refactored Signed-off-by: anastasia prasolova <anastasia@nspcc.ru>
131 lines
6.5 KiB
Text
131 lines
6.5 KiB
Text
*** 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
|