(#88) Delete Container test
Signed-off-by: EliChin <elizaveta@nspcc.ru>
This commit is contained in:
parent
cc9780f4c5
commit
a26118e581
3 changed files with 57 additions and 0 deletions
|
@ -841,6 +841,25 @@ def delete_object(private_key: str, cid: str, oid: str, bearer: str, options: st
|
|||
except subprocess.CalledProcessError as e:
|
||||
raise Exception("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))
|
||||
|
||||
@keyword('Delete Container')
|
||||
# TODO: make the error message about a non-found container more user-friendly https://github.com/nspcc-dev/neofs-contract/issues/121
|
||||
def delete_container(cid: str, private_key: str):
|
||||
|
||||
deleteContainerCmd = (
|
||||
f'{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} --wif {private_key} '
|
||||
f'container delete --cid {cid} --await'
|
||||
)
|
||||
logger.info("Cmd: %s" % deleteContainerCmd)
|
||||
|
||||
try:
|
||||
subprocess.run(deleteContainerCmd, check=True, universal_newlines=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=300, shell=True)
|
||||
|
||||
logger.info("Container %s has been deleted" % cid)
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
raise Exception("Error: \nreturn code: %s. \nOutput: %s" % (e.returncode, e.stderr))
|
||||
|
||||
@keyword('Get file name')
|
||||
def get_file_name(filepath):
|
||||
filename = os.path.basename(filepath)
|
||||
|
@ -1190,6 +1209,7 @@ def _search_object(node:str, private_key: str, cid:str, oid: str):
|
|||
f'{NEOFS_CLI_EXEC} --rpc-endpoint {node} --wif {private_key} --ttl 1 '
|
||||
f'object search --root --cid {cid} {oid_cmd}'
|
||||
)
|
||||
|
||||
try:
|
||||
logger.info(Cmd)
|
||||
complProc = subprocess.run(Cmd, check=True, universal_newlines=True,
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
*** Settings ***
|
||||
Variables ../../../variables/common.py
|
||||
|
||||
Library ../${RESOURCES}/neofs.py
|
||||
Library ../${RESOURCES}/payment_neogo.py
|
||||
Library ${KEYWORDS}/wallet_keywords.py
|
||||
|
||||
Resource ../${RESOURCES}/setup_teardown.robot
|
||||
Resource ../${RESOURCES}/payment_operations.robot
|
||||
|
||||
*** Test Cases ***
|
||||
Delete Containers
|
||||
[Documentation] Testcase to check if containers can be deleted.
|
||||
[Tags] Container NeoFS NeoCLI
|
||||
[Timeout] 10 min
|
||||
|
||||
[Setup] Setup
|
||||
|
||||
${WALLET} ${ADDR} ${USER_KEY} = Init Wallet with Address ${ASSETS_DIR}
|
||||
Payment Operations ${ADDR} ${USER_KEY}
|
||||
${WALLET_OTH} ${ADDR_OTH} ${OTHER_KEY} = Init Wallet with Address ${ASSETS_DIR}
|
||||
Payment Operations ${ADDR_OTH} ${OTHER_KEY}
|
||||
|
||||
${CID} = Create container ${USER_KEY} 0x1FFFFFFF ${COMMON_PLACEMENT_RULE}
|
||||
Container Existing ${USER_KEY} ${CID}
|
||||
|
||||
Run Keyword And Expect Error *
|
||||
... Delete Container ${CID} ${OTHER_KEY}
|
||||
|
||||
Delete Container ${CID} ${USER_KEY}
|
||||
|
||||
${EXPECTED_ERROR} = Run Keyword And Expect Error *
|
||||
... Delete Container ${CID} ${USER_KEY}
|
||||
Log Container cannot be deleted: ${EXPECTED_ERROR}
|
||||
|
||||
[Teardown] Teardown container_delete
|
||||
|
Loading…
Reference in a new issue