From 42ba6ac462898ab809fd262dd70cfe771ca95375 Mon Sep 17 00:00:00 2001 From: Elizaveta Chichindaeva Date: Mon, 4 Oct 2021 19:16:49 +0300 Subject: [PATCH] (#122) neofs-cli control drop-objects test case Signed-off-by: Elizaveta Chichindaeva --- robot/resources/lib/neofs.py | 9 ++ .../network/netmap_control_drop.robot | 84 +++++++++++++++++++ robot/variables/acl.py | 2 +- robot/variables/common.py | 13 ++- 4 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 robot/testsuites/integration/network/netmap_control_drop.robot diff --git a/robot/resources/lib/neofs.py b/robot/resources/lib/neofs.py index add45441..63a18343 100644 --- a/robot/resources/lib/neofs.py +++ b/robot/resources/lib/neofs.py @@ -763,6 +763,15 @@ def get_control_endpoint_with_wif(endpoint_number: str = ''): return endpoint_num, endpoint_control, wif +@keyword('Get Locode') +def get_locode(): + endpoint_values = random.choice(list(NEOFS_NETMAP_DICT.values())) + locode = endpoint_values['UN-LOCODE'] + logger.info(f'Random locode chosen: {locode}') + + return locode + + @keyword('Get Nodes Log Latest Timestamp') def get_logs_latest_timestamp(): """ diff --git a/robot/testsuites/integration/network/netmap_control_drop.robot b/robot/testsuites/integration/network/netmap_control_drop.robot new file mode 100644 index 00000000..361bc64f --- /dev/null +++ b/robot/testsuites/integration/network/netmap_control_drop.robot @@ -0,0 +1,84 @@ +*** Settings *** +Variables ../../../variables/common.py +Variables ../../../variables/acl.py + +Library Process +Library contract_keywords.py +Library neofs.py +Library String + +Library payment_neogo.py + +Resource setup_teardown.robot +Resource payment_operations.robot +Resource storage.robot + +*** Variables *** +${CONTAINER_WAIT_INTERVAL} = 1 min + +*** Test Cases *** +Drop command in control group + [Documentation] Testcase to check drop-objects command from control group. + [Tags] NeoFSCLI + [Timeout] 10 min + + [Setup] Setup + + ${NODE_NUM} ${NODE} ${WIF} = Get control endpoint with wif + ${LOCODE} = Get Locode + + ${FILE_SIMPLE} = Generate file of bytes ${SIMPLE_OBJ_SIZE} + ${FILE_COMPLEX} = Generate file of bytes ${COMPLEX_OBJ_SIZE} + + ${WALLET} ${ADDR} ${USER_KEY} = Init Wallet with Address ${ASSETS_DIR} + Payment Operations ${ADDR} ${USER_KEY} + + ${PRIV_CID} = Create container ${USER_KEY} ${PRIVATE_ACL} REP 1 CBF 1 SELECT 1 FROM * FILTER 'UN-LOCODE' EQ '${LOCODE}' AS LOC + Wait Until Keyword Succeeds ${MORPH_BLOCK_TIME} ${CONTAINER_WAIT_INTERVAL} + ... Container Existing ${USER_KEY} ${PRIV_CID} + + ######################### + # Dropping simple object + ######################### + + ${S_OID} = Put object ${USER_KEY} ${FILE_SIMPLE} ${PRIV_CID} ${EMPTY} ${EMPTY} + Get object ${USER_KEY} ${PRIV_CID} ${S_OID} ${EMPTY} s_file_read + Head object ${NEOFS_IR_WIF} ${PRIV_CID} ${S_OID} ${EMPTY} ${EMPTY} + + Drop object ${NODE} ${WIF} ${PRIV_CID} ${S_OID} + + Wait Until Keyword Succeeds 3x ${SHARD_0_GC_SLEEP} + ... Run Keyword And Expect Error Error:* + ... Get object ${USER_KEY} ${PRIV_CID} ${S_OID} ${EMPTY} s_file_read options='--ttl 1' + Run Keyword And Expect Error Error:* + ... Head object ${NEOFS_IR_WIF} ${PRIV_CID} ${S_OID} ${EMPTY} ${EMPTY} + + Drop object ${NODE} ${WIF} ${PRIV_CID} ${S_OID} + + ########################## + # Dropping complex object + ########################## + + ${C_OID} = Put object ${USER_KEY} ${FILE_COMPLEX} ${PRIV_CID} ${EMPTY} ${EMPTY} + Get object ${USER_KEY} ${PRIV_CID} ${C_OID} ${EMPTY} s_file_read + Head object ${NEOFS_IR_WIF} ${PRIV_CID} ${C_OID} ${EMPTY} ${EMPTY} + + Drop object ${NODE} ${WIF} ${PRIV_CID} ${C_OID} + + Get object ${USER_KEY} ${PRIV_CID} ${C_OID} ${EMPTY} s_file_read + Head object ${NEOFS_IR_WIF} ${PRIV_CID} ${C_OID} ${EMPTY} ${EMPTY} + + @{SPLIT_OIDS} = Get Split objects ${USER_KEY} ${PRIV_CID} ${C_OID} + FOR ${CHILD_OID} IN @{SPLIT_OIDS} + Drop object ${NODE} ${WIF} ${PRIV_CID} ${CHILD_OID} + + END + + Wait Until Keyword Succeeds 3x ${SHARD_0_GC_SLEEP} + ... Run Keyword And Expect Error Error:* + ... Get object ${USER_KEY} ${PRIV_CID} ${C_OID} ${EMPTY} s_file_read options='--ttl 1' + Run Keyword And Expect Error Error:* + ... Head object ${NEOFS_IR_WIF} ${PRIV_CID} ${C_OID} ${EMPTY} ${EMPTY} + + + [Teardown] Teardown netmap_control_drop diff --git a/robot/variables/acl.py b/robot/variables/acl.py index ebac128c..737ef3b5 100644 --- a/robot/variables/acl.py +++ b/robot/variables/acl.py @@ -1,4 +1,4 @@ PUBLIC_ACL = "0x1FFFFFFF" PRIVATE_ACL = "0x18888888" READONLY_ACL = "0x1FFF88FF" -INACCESSIBLE_ACL = "0x40000000 " +INACCESSIBLE_ACL = "0x40000000" diff --git a/robot/variables/common.py b/robot/variables/common.py index e79756a5..7be96565 100644 --- a/robot/variables/common.py +++ b/robot/variables/common.py @@ -20,6 +20,7 @@ MAINNET_BLOCK_TIME = os.getenv('MAINNET_BLOCK_TIME', "15s") MAINNET_TIMEOUT = os.getenv('MAINNET_TIMEOUT', "1min") MORPH_BLOCK_TIME = os.getenv("MORPH_BLOCK_TIME", '1s') NEOFS_CONTRACT_CACHE_TIMEOUT = os.getenv("NEOFS_CONTRACT_CACHE_TIMEOUT", "30s") +SHARD_0_GC_SLEEP = os.getenv("NEOFS_STORAGE_SHARD_0_GC_REMOVER_SLEEP_INTERVAL", "1m") NEOFS_IR_WIF = os.getenv("NEOFS_IR_WIF", "KxyjQ8eUa4FHt3Gvioyt1Wz29cTUrE4eTqX3yFSk1YFCsPL8uNsY") NEOFS_SN_WIF = os.getenv("NEOFS_SN_WIF", "Kwk6k2eC3L3QuPvD8aiaNyoSXgQ2YL1bwS5CP1oKoA9waeAze97s") @@ -46,15 +47,19 @@ GATE_PUB_KEY = '0313b1ac3a8076e155a7e797b24f0b650cccad5941ea59d7cfd51a024a8b2a06 NEOFS_NETMAP_DICT = {'s01': {'rpc': 's01.neofs.devenv:8080', 'control': 's01.neofs.devenv:8081', - 'wif': 'Kwk6k2eC3L3QuPvD8aiaNyoSXgQ2YL1bwS5CP1oKoA9waeAze97s'}, + 'wif': 'Kwk6k2eC3L3QuPvD8aiaNyoSXgQ2YL1bwS5CP1oKoA9waeAze97s', + 'UN-LOCODE': 'RU MOW'}, 's02': {'rpc': 's02.neofs.devenv:8080', 'control': 's02.neofs.devenv:8081', - 'wif': 'L1NdHdnrTNGQZH1fJSrdUZJyeYFHvaQSSHZHxhK3udiGFdr5YaZ6'}, + 'wif': 'L1NdHdnrTNGQZH1fJSrdUZJyeYFHvaQSSHZHxhK3udiGFdr5YaZ6', + 'UN-LOCODE': 'RU LED'}, 's03': {'rpc': 's03.neofs.devenv:8080', 'control': 's03.neofs.devenv:8081', - 'wif': 'KzN38k39af6ACWJjK8YrnARWo86ddcc1EuBWz7xFEdcELcP3ZTym'}, + 'wif': 'KzN38k39af6ACWJjK8YrnARWo86ddcc1EuBWz7xFEdcELcP3ZTym', + 'UN-LOCODE': 'SE STO'}, 's04': {'rpc': 's04.neofs.devenv:8080', 'control': 's04.neofs.devenv:8081', - 'wif': 'Kzk1Z3dowAqfNyjqeYKWenZMduFV3NAKgXg9K1sA4jRKYxEc8HEW'} + 'wif': 'Kzk1Z3dowAqfNyjqeYKWenZMduFV3NAKgXg9K1sA4jRKYxEc8HEW', + 'UN-LOCODE': 'FI HEL'} } NEOFS_NETMAP = [i['rpc'] for i in NEOFS_NETMAP_DICT.values()] \ No newline at end of file